diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/README.md b/README.md
index a48c426..1227378 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
# LimeReport
##How to use it
-* Build limereport.pro. It will create a limereport shared library
-* In your project connect the limereport library then in source code add:
+1. Build limereport.pro. It will create a limereport shared library
+2. In your project connect the limereport library then in source code add:
```C
#include "lrreportengine.h" to add report engine
@@ -15,4 +15,4 @@
report->printReport(); to print report
```
-For more samples see a demo\r1
\ No newline at end of file
+For more samples see a demo
\ No newline at end of file
diff --git a/demo/r1/demo_reports/categories.lrxml b/demo/r1/demo_reports/categories.lrxml
new file mode 100644
index 0000000..165a91e
--- /dev/null
+++ b/demo/r1/demo_reports/categories.lrxml
@@ -0,0 +1,170 @@
+
+
+
diff --git a/demo/r1/demo_reports/demoReport1_report_header_group_subdetail.lrxml b/demo/r1/demo_reports/demoReport1_report_header_group_subdetail.lrxml
new file mode 100644
index 0000000..e036b0e
--- /dev/null
+++ b/demo/r1/demo_reports/demoReport1_report_header_group_subdetail.lrxml
@@ -0,0 +1,632 @@
+
+
+
diff --git a/demo/r1/demo_reports/northwind.db b/demo/r1/demo_reports/northwind.db
new file mode 100644
index 0000000..42a4ef6
Binary files /dev/null and b/demo/r1/demo_reports/northwind.db differ
diff --git a/demo/r1/demo_reports/png/Beverage.png b/demo/r1/demo_reports/png/Beverage.png
new file mode 100644
index 0000000..b818319
Binary files /dev/null and b/demo/r1/demo_reports/png/Beverage.png differ
diff --git a/demo/r1/demo_reports/png/Condiments.png b/demo/r1/demo_reports/png/Condiments.png
new file mode 100644
index 0000000..c658b6e
Binary files /dev/null and b/demo/r1/demo_reports/png/Condiments.png differ
diff --git a/demo/r1/demo_reports/png/Confections.png b/demo/r1/demo_reports/png/Confections.png
new file mode 100644
index 0000000..11ca99c
Binary files /dev/null and b/demo/r1/demo_reports/png/Confections.png differ
diff --git a/demo/r1/demo_reports/png/Confections1.png b/demo/r1/demo_reports/png/Confections1.png
new file mode 100644
index 0000000..55cc2e2
Binary files /dev/null and b/demo/r1/demo_reports/png/Confections1.png differ
diff --git a/demo/r1/demo_reports/png/Confections2.png b/demo/r1/demo_reports/png/Confections2.png
new file mode 100644
index 0000000..bc832a3
Binary files /dev/null and b/demo/r1/demo_reports/png/Confections2.png differ
diff --git a/demo/r1/demo_reports/png/Dairy_Products.png b/demo/r1/demo_reports/png/Dairy_Products.png
new file mode 100644
index 0000000..3e9088b
Binary files /dev/null and b/demo/r1/demo_reports/png/Dairy_Products.png differ
diff --git a/demo/r1/demo_reports/png/Grains_Cereals.png b/demo/r1/demo_reports/png/Grains_Cereals.png
new file mode 100644
index 0000000..10d43ca
Binary files /dev/null and b/demo/r1/demo_reports/png/Grains_Cereals.png differ
diff --git a/demo/r1/demo_reports/png/Grains_Cereals1.png b/demo/r1/demo_reports/png/Grains_Cereals1.png
new file mode 100644
index 0000000..514e33a
Binary files /dev/null and b/demo/r1/demo_reports/png/Grains_Cereals1.png differ
diff --git a/demo/r1/demo_reports/png/Meat_Poultry.png b/demo/r1/demo_reports/png/Meat_Poultry.png
new file mode 100644
index 0000000..3a1d2ef
Binary files /dev/null and b/demo/r1/demo_reports/png/Meat_Poultry.png differ
diff --git a/demo/r1/demo_reports/png/Produce.png b/demo/r1/demo_reports/png/Produce.png
new file mode 100644
index 0000000..8955fe9
Binary files /dev/null and b/demo/r1/demo_reports/png/Produce.png differ
diff --git a/demo/r1/demo_reports/png/Seafood.png b/demo/r1/demo_reports/png/Seafood.png
new file mode 100644
index 0000000..88fd48e
Binary files /dev/null and b/demo/r1/demo_reports/png/Seafood.png differ
diff --git a/demo/r1/images/logo.png b/demo/r1/images/logo.png
new file mode 100644
index 0000000..a466bbb
Binary files /dev/null and b/demo/r1/images/logo.png differ
diff --git a/demo/r1/images/lr.png b/demo/r1/images/lr.png
new file mode 100644
index 0000000..2206744
Binary files /dev/null and b/demo/r1/images/lr.png differ
diff --git a/demo/r1/lr1.ico b/demo/r1/lr1.ico
new file mode 100644
index 0000000..2eba2a4
Binary files /dev/null and b/demo/r1/lr1.ico differ
diff --git a/demo/r1/lr2.ico b/demo/r1/lr2.ico
new file mode 100644
index 0000000..2bc8699
Binary files /dev/null and b/demo/r1/lr2.ico differ
diff --git a/demo/r1/lr3.ico b/demo/r1/lr3.ico
new file mode 100644
index 0000000..7f11705
Binary files /dev/null and b/demo/r1/lr3.ico differ
diff --git a/demo/r1/lr4.ico b/demo/r1/lr4.ico
new file mode 100644
index 0000000..dd68ec8
Binary files /dev/null and b/demo/r1/lr4.ico differ
diff --git a/demo/r1/lr5.ico b/demo/r1/lr5.ico
new file mode 100644
index 0000000..e1bc436
Binary files /dev/null and b/demo/r1/lr5.ico differ
diff --git a/demo/r1/lr6.ico b/demo/r1/lr6.ico
new file mode 100644
index 0000000..6bd0818
Binary files /dev/null and b/demo/r1/lr6.ico differ
diff --git a/demo/r1/main.cpp b/demo/r1/main.cpp
new file mode 100644
index 0000000..06ac390
--- /dev/null
+++ b/demo/r1/main.cpp
@@ -0,0 +1,42 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "mainwindow.h"
+#include
+
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.setWindowIcon(QIcon(":/images/main_ico"));
+ w.show();
+
+ return a.exec();
+}
diff --git a/demo/r1/main.ico b/demo/r1/main.ico
new file mode 100644
index 0000000..6bd0818
Binary files /dev/null and b/demo/r1/main.ico differ
diff --git a/demo/r1/mainicon.rc b/demo/r1/mainicon.rc
new file mode 100644
index 0000000..83c0128
--- /dev/null
+++ b/demo/r1/mainicon.rc
@@ -0,0 +1 @@
+DI_ICON1 ICON "main.ico"
diff --git a/demo/r1/mainwindow.cpp b/demo/r1/mainwindow.cpp
new file mode 100644
index 0000000..2926572
--- /dev/null
+++ b/demo/r1/mainwindow.cpp
@@ -0,0 +1,196 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include
+#include
+#include
+#include
+#include "lrreportengine.h"
+#include "lrcallbackdatasourceintf.h"
+#include
+#include
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow), m_progressDialog(0), m_customers(0), m_orders(0)
+{
+ ui->setupUi(this);
+ report = new LimeReport::ReportEngine(this);
+
+ connect(report, SIGNAL(renderStarted()), this, SLOT(renderStarted()));
+ connect(report, SIGNAL(renderPageFinished(int)),
+ this, SLOT(renderPageFinished(int)));
+ connect(report, SIGNAL(renderFinished()), this, SLOT(renderFinished()));
+
+ QFile dbFile(QApplication::applicationDirPath()+"/demo_reports/northwind.db");
+ if (dbFile.exists()){
+ m_db = QSqlDatabase::addDatabase("QSQLITE");
+ m_db.setDatabaseName(dbFile.fileName());
+ if (m_db.open()){
+ QSqlQueryModel* customersModel = new QSqlQueryModel();
+ customersModel->setQuery("select * from customers", m_db);
+ report->dataManager()->addModel("external_customers_data",customersModel,true);
+ QSqlQueryModel* ordersModel = new QSqlQueryModel();
+ ordersModel->setQuery("Select * from orders",m_db);
+ report->dataManager()->addModel("external_orders_data",ordersModel,true);
+ m_customers = new QSqlQuery("Select * from customers limit 10",m_db);
+ m_customers->first();
+ m_orders = new QSqlQuery(m_db);
+ m_orders->prepare("Select * from orders where CustomerID = :id");
+ m_orders->bindValue(":id",m_customers->value("CustomerID"));
+ m_orders->exec();
+ };
+ }
+
+ LimeReport::ICallbackDatasource * callbackDatasource = report->dataManager()->createCallbackDatasouce("master");
+ connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
+ this, SLOT(slotGetCallbackData(LimeReport::CallbackInfo,QVariant&)));
+ connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
+ this, SLOT(slotChangePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)));
+ //report->dataManager()->addCallbackDatasource(callbackDatasource,"master");
+
+ callbackDatasource = report->dataManager()->createCallbackDatasouce("detail");
+ connect(callbackDatasource, SIGNAL(getCallbackData(LimeReport::CallbackInfo,QVariant&)),
+ this, SLOT(slotGetCallbackChildData(LimeReport::CallbackInfo,QVariant&)));
+ connect(callbackDatasource, SIGNAL(changePos(const LimeReport::CallbackInfo::ChangePosType&,bool&)),
+ this, SLOT(slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType&,bool&)));
+ //report->dataManager()->addCallbackDatasource(callbackDatasource,"detail");
+
+ QStringList simpleData;
+ simpleData << "value1" << "value2" << "value3";
+ QStringListModel* stringListModel = new QStringListModel();
+ stringListModel->setStringList(simpleData);
+
+ report->dataManager()->addModel("string_list",stringListModel,true);
+
+
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+void MainWindow::on_pushButton_clicked()
+{
+ report->dataManager()->clearUserVariables();
+ if (!ui->leVariableName->text().isEmpty() && !ui->leVariableValue->text().isEmpty()){
+ report->dataManager()->setReportVariable(ui->leVariableName->text(), ui->leVariableValue->text());
+ }
+ report->setShowProgressDialog(false);
+ report->designReport();
+}
+
+void MainWindow::on_pushButton_2_clicked()
+{
+ QString fileName = QFileDialog::getOpenFileName(this,"Select report file",QApplication::applicationDirPath()+"/demo_reports/","*.lrxml");
+ if (!fileName.isEmpty()) {
+ report->loadFromFile(fileName);
+ report->previewReport();
+ }
+}
+
+void MainWindow::renderStarted()
+{
+ m_currentPage = 0;
+ m_progressDialog = new QProgressDialog(tr("Start render"),tr("Cancel"),0,0,this);
+ m_progressDialog->setWindowModality(Qt::WindowModal);
+ connect(m_progressDialog, SIGNAL(canceled()), report, SLOT(cancelRender()));
+ m_progressDialog->show();
+ QApplication::processEvents();
+}
+
+void MainWindow::renderPageFinished(int renderedPageCount)
+{
+ if (m_progressDialog){
+ m_progressDialog->setLabelText(QString::number(renderedPageCount)+tr(" page rendered"));
+ m_progressDialog->setValue(renderedPageCount);
+ }
+}
+
+void MainWindow::renderFinished()
+{
+ if (m_progressDialog){
+ m_progressDialog->close();
+ delete m_progressDialog;
+ }
+ m_progressDialog = 0;
+}
+
+void MainWindow::prepareData(QSqlQuery* ds, LimeReport::CallbackInfo info, QVariant &data)
+{
+ switch (info.dataType) {
+ case LimeReport::CallbackInfo::IsEmpty:
+ data = !ds->first();
+ break;
+ case LimeReport::CallbackInfo::HasNext:
+ data = ds->next();
+ if (data.toBool()) ds->previous();
+ break;
+ case LimeReport::CallbackInfo::ColumnHeaderData:
+ if (info.index < ds->record().count())
+ data = ds->record().fieldName(info.index);
+ break;
+ case LimeReport::CallbackInfo::ColumnData:
+ data = ds->value(info.columnName);
+ break;
+ }
+}
+
+void MainWindow::slotGetCallbackData(LimeReport::CallbackInfo info, QVariant &data)
+{
+ if (!m_customers) return;
+ prepareData(m_customers, info, data);
+}
+
+void MainWindow::slotChangePos(const LimeReport::CallbackInfo::ChangePosType &type, bool &result)
+{
+ QSqlQuery* ds = m_customers;
+ if (!ds) return;
+ if (type == LimeReport::CallbackInfo::First) result = ds->first();
+ else result = ds->next();
+ m_orders->bindValue(":id",m_customers->value("CustomerID"));
+ m_orders->exec();
+}
+
+void MainWindow::slotGetCallbackChildData(LimeReport::CallbackInfo info, QVariant &data)
+{
+ if (!m_orders) return ;
+ prepareData(m_orders, info, data);
+}
+
+void MainWindow::slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType &type, bool &result)
+{
+ QSqlQuery* ds = m_orders;
+ if (!ds) return;
+ if (type == LimeReport::CallbackInfo::First) result = ds->first();
+ else result = ds->next();
+}
diff --git a/demo/r1/mainwindow.h b/demo/r1/mainwindow.h
new file mode 100644
index 0000000..e5bbd32
--- /dev/null
+++ b/demo/r1/mainwindow.h
@@ -0,0 +1,80 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include
+#include
+#include
+#include
+#include "lrreportengine.h"
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+private slots:
+ void on_pushButton_clicked();
+ void on_pushButton_2_clicked();
+ void renderStarted();
+ void renderPageFinished(int renderedPageCount);
+ void renderFinished();
+ void slotGetCallbackData(LimeReport::CallbackInfo info, QVariant& data);
+ void slotChangePos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
+ void slotGetCallbackChildData(LimeReport::CallbackInfo info, QVariant& data);
+ void slotChangeChildPos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
+private:
+ void prepareData(QSqlQuery* ds, LimeReport::CallbackInfo info, QVariant &data);
+private:
+ Ui::MainWindow *ui;
+ LimeReport::ReportEngine *report;
+ QProgressDialog* m_progressDialog;
+ int m_currentPage;
+ QSqlDatabase m_db;
+ int m_currentMasterRecord;
+ QVector m_childData;
+
+ int m_currentCustomerRecord;
+ int m_currentOrderRecord;
+ QSqlQuery* m_customers;
+ QSqlQuery* m_orders;
+
+};
+
+
+
+#endif // MAINWINDOW_H
diff --git a/demo/r1/mainwindow.ui b/demo/r1/mainwindow.ui
new file mode 100644
index 0000000..52eebe9
--- /dev/null
+++ b/demo/r1/mainwindow.ui
@@ -0,0 +1,213 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 369
+ 192
+
+
+
+
+ 75
+ true
+
+
+
+ DEMO
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 100
+ 100
+
+
+
+
+
+
+ :/images/logo
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+ Report setting
+
+
+
+
+
+ QFormLayout::AllNonFixedFieldsGrow
+
+
+
+
+ TestName
+
+
+
+
+
+
+ Variable Value
+
+
+
+
+
+
+ TestValue
+
+
+
+
+
+
+ Variable Name
+
+
+
+
+
+
+
+
+
+
+
+ Qt::Vertical
+
+
+
+ 160
+ 23
+
+
+
+
+
+
+
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+ Run Report Preview
+
+
+
+
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+ Run Report Designer
+
+
+
+
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+ Qt::Vertical
+
+
+
+ 160
+ 28
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/demo/r1/r1.pro b/demo/r1/r1.pro
new file mode 100644
index 0000000..36665f2
--- /dev/null
+++ b/demo/r1/r1.pro
@@ -0,0 +1,44 @@
+QT += core gui script sql
+
+EXTRA_DIR += $$PWD/demo_reports/*
+
+win32:CONFIG(release, debug|release): DEST_DIR = $$OUT_PWD/demo_reports/
+win32:CONFIG(debug, debug|release): DEST_DIR = $$OUT_PWD/demo_reports/
+
+unix{
+ DEST_DIR = $$OUT_PWD/demo_reports/
+ QMAKE_POST_LINK += mkdir -p $$quote($$DEST_DIR) | $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$DEST_DIR) $$escape_expand(\n\t)
+}
+
+win32 {
+ EXTRA_DIR ~= s,/,\\,g
+ DEST_DIR ~= s,/,\\,g
+ QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR) $$quote($$DEST_DIR) $$escape_expand(\\n\\t)
+}
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
+
+TARGET = r1
+TEMPLATE = app
+
+SOURCES += main.cpp\
+ mainwindow.cpp
+
+HEADERS += mainwindow.h
+
+FORMS += mainwindow.ui
+
+win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../lib/release -llimereport
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../lib/debug -llimereport
+else:unix:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../lib/debug -llimereport
+else:unix:CONFIG(release, debug|release): LIBS += -L$$PWD/../../lib/release -llimereport
+
+INCLUDEPATH += $$PWD/../../include
+DEPENDPATH += $$PWD/../../include
+
+RESOURCES += \
+ r1.qrc
+
+win32 {
+ RC_FILE += mainicon.rc
+}
\ No newline at end of file
diff --git a/demo/r1/r1.qrc b/demo/r1/r1.qrc
new file mode 100644
index 0000000..1e604e8
--- /dev/null
+++ b/demo/r1/r1.qrc
@@ -0,0 +1,9 @@
+
+
+ images/logo.png
+ main.ico
+ images/lr.png
+ lr1.ico
+ lr6.ico
+
+
diff --git a/include/lrcallbackdatasourceintf.h b/include/lrcallbackdatasourceintf.h
new file mode 100644
index 0000000..3259f4b
--- /dev/null
+++ b/include/lrcallbackdatasourceintf.h
@@ -0,0 +1,24 @@
+#ifndef LRVIRTUALDATASOURCEINTF
+#define LRVIRTUALDATASOURCEINTF
+#include
+namespace LimeReport {
+
+struct CallbackInfo{
+ enum DataType{IsEmpty, HasNext, ColumnHeaderData, ColumnData};
+ enum ChangePosType{First, Next};
+ DataType dataType;
+ int index;
+ QString columnName;
+};
+
+class ICallbackDatasource :public QObject{
+ Q_OBJECT
+signals:
+ void getCallbackData(const LimeReport::CallbackInfo& info, QVariant& data);
+ void changePos(const LimeReport::CallbackInfo::ChangePosType& type, bool& result);
+};
+
+}
+
+#endif // LRVIRTUALDATASOURCEINTF
+
diff --git a/include/lrdatasourcemanagerintf.h b/include/lrdatasourcemanagerintf.h
new file mode 100644
index 0000000..123f049
--- /dev/null
+++ b/include/lrdatasourcemanagerintf.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRDATASOURCEMANAGERINTF_H
+#define LRDATASOURCEMANAGERINTF_H
+
+#include "lrcallbackdatasourceintf.h"
+
+class QVariant;
+class QString;
+class QAbstractItemModel;
+namespace LimeReport{
+
+class IDataSourceManager{
+public:
+ virtual void setReportVariable(const QString& name, const QVariant& value)=0;
+ virtual void deleteVariable(const QString& name)=0;
+ virtual bool containsVariable(const QString& variableName)=0;
+ virtual QVariant variable(const QString& variableName)=0;
+ virtual void addModel(const QString& name, QAbstractItemModel *model, bool owned)=0;
+ virtual bool containsDatasource(const QString& dataSourceName)=0;
+ virtual void clearUserVariables()=0;
+ virtual ICallbackDatasource* createCallbackDatasouce(const QString& name) = 0;
+ virtual void addCallbackDatasource(ICallbackDatasource* datasource, const QString& name) = 0;
+};
+
+}
+#endif // LRDATASOURCEMANAGERINTF_H
diff --git a/include/lrglobal.cpp b/include/lrglobal.cpp
new file mode 100644
index 0000000..34bd880
--- /dev/null
+++ b/include/lrglobal.cpp
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include
+#include
+#include "lrglobal.h"
+
+QString LimeReport::extractClassName(QString className)
+{
+ int startPos=className.lastIndexOf("::");
+ if(startPos==-1) startPos=0;
+ else startPos+=2;
+ return className.right(className.length()-startPos);
+}
diff --git a/include/lrglobal.h b/include/lrglobal.h
new file mode 100644
index 0000000..a701619
--- /dev/null
+++ b/include/lrglobal.h
@@ -0,0 +1,76 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef GLOBAL_H
+#define GLOBAL_H
+#include "qglobal.h"
+#include
+#include
+
+#if defined(LIMEREPORT_EXPORTS)
+# define LIMEREPORT_EXPORT Q_DECL_EXPORT
+#elif defined (LIMEREPORT_IMPORTS)
+# define LIMEREPORT_EXPORT Q_DECL_IMPORT
+#else
+# define LIMEREPORT_EXPORT /**/
+#endif
+
+namespace LimeReport {
+ const qreal fontFACTOR = 3.5;
+ const int mmFACTOR = 10;
+ const int itemPaleteIconSize = 24;
+ const qreal minSpaceBorder = 10;
+ QString extractClassName(QString className);
+ const QString bandTAG = "band";
+ const qreal BAND_MARKER_OPACITY = 1;
+ const qreal LAYOUT_MARKER_OPACITY = 0.3;
+ const qreal BAND_NAME_AREA_OPACITY = 0.3;
+ const qreal BAND_NAME_TEXT_OPACITY = 0.6;
+ const qreal SELECTION_OPACITY = 0.3;
+ enum RenderPass {FirstPass, SecondPass};
+ enum ArrangeType {AsNeeded, Force};
+ const QString FIELD_RX = "\\$D\\s*\\{\\s*([^\\s{}]*)\\s*\\}";
+ const QString VARIABLE_RX = "\\$V\\s*\\{\\s*([^\\s{}]*)\\s*\\}";
+ const QString SCRIPT_RX = "\\$S\\s*\\{(.*)\\}";
+ const QString GROUP_FUNCTION_PARAM_RX = "\\(\\s*(((?:\\\"?\\$D\\s*\\{\\s*)|(?:\\\"?\\$V\\s*\\{\\s*)|(?:\\\"))(\\w+\\.?\\w+)((?:\\\")|(?:\\s*\\}\\\"?\\s*)))\\s*,\\s*\\\"(\\w+)\\\"\\s*\\)";
+ const int DATASOURCE_INDEX = 6;
+ const int VALUE_INDEX = 2;
+ const QString GROUP_FUNCTION_RX = "(%1\\s*"+GROUP_FUNCTION_PARAM_RX+")";
+ const QString GROUP_FUNCTION_NAME_RX = "%1\\s*\\((.*[^\\)])\\)";
+ const int SCENE_MARGIN = 50;
+ class ReportError : public std::runtime_error{
+ public:
+ ReportError(const QString& message):std::runtime_error(message.toStdString()){}
+ };
+
+} // namespace LimeReport
+
+
+
+#endif // GLOBAL_H
diff --git a/include/lrreportengine.h b/include/lrreportengine.h
new file mode 100644
index 0000000..924976a
--- /dev/null
+++ b/include/lrreportengine.h
@@ -0,0 +1,105 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRREPORTDESIGNINTF_H
+#define LRREPORTDESIGNINTF_H
+
+#include
+#include
+#include
+
+#include "lrglobal.h"
+#include "lrdatasourcemanagerintf.h"
+#include "lrscriptenginemanagerintf.h"
+//#include "lrreportrender.h"
+
+class QPrinter;
+
+namespace LimeReport {
+
+
+class PrintRange{
+public:
+ int fromPage() const { return m_fromPage;}
+ int toPage() const { return m_toPage;}
+ QPrintDialog::PrintRange rangeType() const { return m_rangeType;}
+ PrintRange(QAbstractPrintDialog::PrintRange rangeType=QPrintDialog::AllPages, int fromPage=0, int toPage=0);
+ void setRangeType(QAbstractPrintDialog::PrintRange rangeType){ m_rangeType=rangeType;}
+ void setFromPage(int fromPage){ m_fromPage = fromPage;}
+ void setToPage(int toPage){ m_toPage = toPage;}
+private:
+ QPrintDialog::PrintRange m_rangeType;
+ int m_fromPage;
+ int m_toPage;
+};
+
+class DataSourceManager;
+class ReportEnginePrivate;
+//class PageDesignIntf;
+
+class LIMEREPORT_EXPORT ReportEngine : public QObject{
+ Q_OBJECT
+public:
+ static void setSettings(QSettings *value){m_settings=value;}
+public:
+ explicit ReportEngine(QObject *parent = 0);
+ ~ReportEngine();
+ bool printReport(QPrinter *printer=0);
+ //void printReport(ReportPages pages, QPrinter &printer);
+ void printToFile(const QString& fileName);
+ //PageDesignIntf *createPreviewScene(QObject *parent = 0);
+ void previewReport();
+ void designReport();
+ void setShowProgressDialog(bool value);
+ IDataSourceManager* dataManager();
+ IScriptEngineManager* scriptManager();
+
+ bool loadFromFile(const QString& fileName);
+ bool loadFromByteArray(QByteArray *data);
+ QString reportFileName();
+ bool saveToFile();
+ bool saveToFile(const QString& fileName);
+ QString lastError();
+signals:
+ void renderStarted();
+ void renderFinished();
+ void renderPageFinished(int renderedPageCount);
+public slots:
+ void cancelRender();
+protected:
+ ReportEnginePrivate * const d_ptr;
+ ReportEngine(ReportEnginePrivate &dd, QObject * parent=0);
+private:
+ Q_DECLARE_PRIVATE(ReportEngine)
+ static QSettings* m_settings;
+};
+
+} // namespace LimeReport
+
+#endif // LRREPORTDESIGNINTF_H
diff --git a/include/lrscriptenginemanagerintf.h b/include/lrscriptenginemanagerintf.h
new file mode 100644
index 0000000..56284da
--- /dev/null
+++ b/include/lrscriptenginemanagerintf.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRSCRIPTENGINEMANAGERINTF_H
+#define LRSCRIPTENGINEMANAGERINTF_H
+
+#include
+
+namespace LimeReport{
+
+class IScriptEngineManager{
+public:
+ virtual QScriptEngine* scriptEngine() = 0;
+ virtual QScriptValue addFunction(const QString& name, QScriptEngine::FunctionSignature function,
+ const QString& category="", const QString& description="") = 0;
+ virtual QScriptValue addFunction(const QString &name, const QString& script,
+ const QString &category="", const QString &description="") = 0;
+ virtual const QString& lastError() const = 0;
+ virtual ~IScriptEngineManager(){}
+};
+
+} //namespace LimeReport
+#endif // LRSCRIPTENGINEMANAGERINTF_H
diff --git a/lib/.gitignore b/lib/.gitignore
new file mode 100644
index 0000000..591459e
--- /dev/null
+++ b/lib/.gitignore
@@ -0,0 +1,5 @@
+release/*
+debug/*
+*.so.1.0.0.debug
+*.so.1.0.0
+/ReportGenerator.app/
diff --git a/limereport.pro b/limereport.pro
new file mode 100644
index 0000000..6ae3a53
--- /dev/null
+++ b/limereport.pro
@@ -0,0 +1,45 @@
+#CONFIG +=zint
+#QMAKE_CFLAGS += -std=c99
+#ZINT_PATH = $$PWD/../zint-2.4.3
+#ZINT_VERSION = 2.4.3
+#include(qzint.pri)
+include(report-lib.pri)
+
+TEMPLATE = lib
+QT += core xml sql script
+TARGET = limereport
+
+DEFINES += LIMEREPORT_EXPORTS
+
+EXTRA_FILES += \
+ $$PWD/src/lrglobal.cpp \
+ $$PWD/src/lrglobal.h \
+ $$PWD/src/lrdatasourcemanagerintf.h \
+ $$PWD/src/lrreportengine.h \
+ $$PWD/src/lrscriptenginemanagerintf.h \
+ $$PWD/src/lrcallbackdatasourceintf.h
+
+DEST_DIR = $$PWD/include/
+
+unix {
+ for(FILE,EXTRA_FILES){
+ QMAKE_POST_LINK += $$quote($$QMAKE_COPY $${FILE} $${DEST_DIR}$$escape_expand(\n\t))
+ }
+}
+
+win32 {
+ EXTRA_FILES ~= s,/,\\,g
+ DEST_DIR ~= s,/,\\,g
+ for(FILE,EXTRA_FILES){
+ QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($$DEST_DIR) $$escape_expand(\\n\\t)
+ }
+}
+
+DESTDIR = $$PWD/lib
+
+DEPENDPATH += report report/bands report/base report/databrowser report/items report/objectinspector
+INCLUDEPATH += report report/bands report/base report/databrowser report/items report/objectinspector
+
+CONFIG(release, debug|release): DESTDIR = $$PWD/lib/release/
+else:CONFIG(debug, debug|release): DESTDIR = $$PWD/lib/debug/
+
diff --git a/qzint.pri b/qzint.pri
new file mode 100644
index 0000000..51a6a50
--- /dev/null
+++ b/qzint.pri
@@ -0,0 +1,64 @@
+DEFINES += _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS ZINT_VERSION=\\\"$$ZINT_VERSION\\\" NO_PNG
+
+!contains(DEFINES, NO_PNG) {
+ LIBS += -lpng
+}
+
+INCLUDEPATH += \
+ $$ZINT_PATH/backend \
+ $$ZINT_PATH/backend_qt4
+
+HEADERS += $$ZINT_PATH/backend/aztec.h \
+ $$ZINT_PATH/backend/code1.h \
+ $$ZINT_PATH/backend/code49.h \
+ $$ZINT_PATH/backend/common.h \
+ $$ZINT_PATH/backend/composite.h \
+ $$ZINT_PATH/backend/dmatrix.h \
+ $$ZINT_PATH/backend/font.h \
+ $$ZINT_PATH/backend/gb2312.h \
+ $$ZINT_PATH/backend/gridmtx.h \
+ $$ZINT_PATH/backend/gs1.h \
+ $$ZINT_PATH/backend/large.h \
+ $$ZINT_PATH/backend/maxicode.h \
+ $$ZINT_PATH/backend/maxipng.h \
+ $$ZINT_PATH/backend/ms_stdint.h \
+ $$ZINT_PATH/backend/pdf417.h \
+ $$ZINT_PATH/backend/qr.h \
+ $$ZINT_PATH/backend/reedsol.h \
+ $$ZINT_PATH/backend/rss.h \
+ $$ZINT_PATH/backend/sjis.h \
+ $$ZINT_PATH/backend/zint.h \
+ $$ZINT_PATH/backend_qt4/qzint.h
+
+SOURCES += $$ZINT_PATH/backend/2of5.c \
+ $$ZINT_PATH/backend/auspost.c \
+ $$ZINT_PATH/backend/aztec.c \
+ $$ZINT_PATH/backend/code.c \
+ $$ZINT_PATH/backend/code1.c \
+ $$ZINT_PATH/backend/code128.c \
+ $$ZINT_PATH/backend/code16k.c \
+ $$ZINT_PATH/backend/code49.c \
+ $$ZINT_PATH/backend/common.c \
+ $$ZINT_PATH/backend/composite.c \
+ $$ZINT_PATH/backend/dmatrix.c \
+ $$ZINT_PATH/backend/gridmtx.c \
+ $$ZINT_PATH/backend/gs1.c \
+ $$ZINT_PATH/backend/imail.c \
+ $$ZINT_PATH/backend/large.c \
+ $$ZINT_PATH/backend/library.c \
+ $$ZINT_PATH/backend/maxicode.c \
+ $$ZINT_PATH/backend/medical.c \
+ $$ZINT_PATH/backend/pdf417.c \
+ $$ZINT_PATH/backend/plessey.c \
+ $$ZINT_PATH/backend/postal.c \
+ $$ZINT_PATH/backend/ps.c \
+ $$ZINT_PATH/backend/qr.c \
+ $$ZINT_PATH/backend/reedsol.c \
+ $$ZINT_PATH/backend/render.c \
+ $$ZINT_PATH/backend/rss.c \
+ $$ZINT_PATH/backend/svg.c \
+ $$ZINT_PATH/backend/telepen.c \
+ $$ZINT_PATH/backend/upcean.c \
+ $$ZINT_PATH/backend/dllversion.c \
+ $$ZINT_PATH/backend/png.c \
+ $$ZINT_PATH/backend_qt4/qzint.cpp
diff --git a/report-lib.pri b/report-lib.pri
new file mode 100644
index 0000000..5563ea5
--- /dev/null
+++ b/report-lib.pri
@@ -0,0 +1,228 @@
+QT += script xml sql
+REPORT_PATH = $$PWD
+
+LIMEREPORT_VERSION_MAJOR = 1
+LIMEREPORT_VERSION_MINOR = 0
+LIMEREPORT_VERSION_RELEASE = 1
+
+LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"'
+DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\"
+DEFINES += LIMEREPORT_VERSION=$${LIMEREPORT_VERSION}
+
+greaterThan(QT_MAJOR_VERSION, 4) {
+ DEFINES+=HAVE_QT5
+ QT+= printsupport widgets
+
+ contains(QT,uitools){
+ message(uitools)
+ DEFINES += HAVE_UI_LOADER
+ }
+}
+
+lessThan(QT_MAJOR_VERSION, 5){
+ CONFIG(uitools){
+ message(uitools)
+ DEFINES += HAVE_UI_LOADER
+ }
+}
+
+DEFINES += INSPECT_BASEDESIGN
+
+REPORT_PATH = $$PWD/src
+
+INCLUDEPATH += \
+ $$REPORT_PATH/ \
+ $$REPORT_PATH/items \
+ $$REPORT_PATH/bands \
+ $$REPORT_PATH/base \
+ $$REPORT_PATH/objectinspector \
+ $$REPORT_PATH/databrowser
+
+SOURCES += \
+ $$REPORT_PATH/items/lrtextitem.cpp \
+ $$REPORT_PATH/bands/lrpageheader.cpp \
+ $$REPORT_PATH/bands/lrpagefooter.cpp \
+ $$REPORT_PATH/bands/lrreportheader.cpp \
+ $$REPORT_PATH/bands/lrreportfooter.cpp \
+ $$REPORT_PATH/bands/lrdataband.cpp \
+ $$REPORT_PATH/bands/lrgroupbands.cpp \
+ $$REPORT_PATH/bands/lrsubdetailband.cpp \
+ $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.cpp \
+ $$REPORT_PATH/objectinspector/lrobjectitemmodel.cpp \
+ $$REPORT_PATH/objectinspector/lrobjectpropitem.cpp \
+ $$REPORT_PATH/objectinspector/lrpropertydelegate.cpp \
+ $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.cpp \
+ $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.cpp \
+ $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.cpp \
+ $$REPORT_PATH/objectinspector/propertyItems/lrenumpropitem.cpp \
+ $$REPORT_PATH/objectinspector/propertyItems/lrboolpropitem.cpp \
+ $$REPORT_PATH/objectinspector/propertyItems/lrflagspropitem.cpp \
+ $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.cpp \
+ $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.cpp \
+ $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.cpp \
+ $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.cpp \
+ $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.cpp \
+ $$REPORT_PATH/objectinspector/editors/lrfonteditor.cpp \
+ $$REPORT_PATH/objectinspector/editors/lrimageeditor.cpp \
+ $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.cpp \
+ $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.cpp \
+ $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.cpp \
+ $$REPORT_PATH/objectinspector/editors/lrcoloreditor.cpp \
+ $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.cpp \
+ $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.cpp \
+ $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.cpp \
+ $$REPORT_PATH/objectsbrowser/lrobjectbrowser.cpp \
+ $$REPORT_PATH/databrowser/lrdatabrowser.cpp \
+ $$REPORT_PATH/databrowser/lrsqleditdialog.cpp \
+ $$REPORT_PATH/databrowser/lrconnectiondialog.cpp \
+ $$REPORT_PATH/databrowser/lrvariabledialog.cpp \
+ $$REPORT_PATH/databrowser/lrdatabrowsertree.cpp \
+ $$REPORT_PATH/serializators/lrxmlqrectserializator.cpp \
+ $$REPORT_PATH/serializators/lrxmlbasetypesserializators.cpp \
+ $$REPORT_PATH/serializators/lrxmlreader.cpp \
+ $$REPORT_PATH/serializators/lrxmlwriter.cpp \
+ $$REPORT_PATH/items/lrsubitemparentpropitem.cpp \
+ $$REPORT_PATH/items/lralignpropitem.cpp \
+ $$REPORT_PATH/items/lrhorizontallayout.cpp \
+ $$REPORT_PATH/items/editors/lritemeditorwidget.cpp \
+ $$REPORT_PATH/items/editors/lrfonteditorwidget.cpp \
+ $$REPORT_PATH/items/editors/lrtextalignmenteditorwidget.cpp \
+ $$REPORT_PATH/items/editors/lritemsaligneditorwidget.cpp \
+ $$REPORT_PATH/items/editors/lritemsborderseditorwidget.cpp \
+ $$REPORT_PATH/items/lrsimpletagparser.cpp \
+ $$REPORT_PATH/items/lrimageitem.cpp \
+ $$REPORT_PATH/items/lrtextitemeditor.cpp \
+ $$REPORT_PATH/items/lrshapeitem.cpp \
+ $$REPORT_PATH/lrbanddesignintf.cpp \
+ $$REPORT_PATH/lrpageitemdesignintf.cpp \
+ $$REPORT_PATH/lrpagedesignintf.cpp \
+ $$REPORT_PATH/lrbandsmanager.cpp \
+ $$REPORT_PATH/lrglobal.cpp \
+ $$REPORT_PATH/lritemdesignintf.cpp \
+ $$REPORT_PATH/lrdatadesignintf.cpp \
+ $$REPORT_PATH/lrreportdesignwidget.cpp \
+ $$REPORT_PATH/lrbasedesignintf.cpp \
+ $$REPORT_PATH/lrreportengine.cpp \
+ $$REPORT_PATH/lrdatasourcemanager.cpp \
+ $$REPORT_PATH/lrreportdesignwindow.cpp \
+ $$REPORT_PATH/waitform.cpp \
+ $$REPORT_PATH/lrreportrender.cpp \
+ $$REPORT_PATH/lrscriptenginemanager.cpp \
+ $$REPORT_PATH/lrpreviewreportwindow.cpp \
+ $$REPORT_PATH/lrvariablesholder.cpp \
+ $$REPORT_PATH/lrgroupfunctions.cpp \
+ $$REPORT_PATH/lrsimplecrypt.cpp \
+ $$REPORT_PATH/lraboutdialog.cpp
+
+contains(CONFIG, zint){
+ SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp
+}
+
+HEADERS += \
+ $$REPORT_PATH/base/lrsingleton.h \
+ $$REPORT_PATH/bands/lrpageheader.h \
+ $$REPORT_PATH/bands/lrpagefooter.h \
+ $$REPORT_PATH/bands/lrreportheader.h \
+ $$REPORT_PATH/bands/lrreportfooter.h \
+ $$REPORT_PATH/bands/lrdataband.h \
+ $$REPORT_PATH/objectinspector/lrobjectinspectorwidget.h \
+ $$REPORT_PATH/objectinspector/lrobjectitemmodel.h \
+ $$REPORT_PATH/objectinspector/lrobjectpropitem.h \
+ $$REPORT_PATH/objectinspector/lrpropertydelegate.h \
+ $$REPORT_PATH/objectinspector/propertyItems/lrstringpropitem.h \
+ $$REPORT_PATH/objectinspector/propertyItems/lrrectproptem.h \
+ $$REPORT_PATH/databrowser/lrdatabrowser.h \
+ $$REPORT_PATH/databrowser/lrsqleditdialog.h \
+ $$REPORT_PATH/databrowser/lrconnectiondialog.h \
+ $$REPORT_PATH/databrowser/lrvariabledialog.h \
+ $$REPORT_PATH/databrowser/lrdatabrowsertree.h \
+ $$REPORT_PATH/objectinspector/propertyItems/lrdatasourcepropitem.h \
+ $$REPORT_PATH/lrbanddesignintf.h \
+ $$REPORT_PATH/lrpageitemdesignintf.h \
+ $$REPORT_PATH/lrbandsmanager.h \
+ $$REPORT_PATH/lrglobal.h \
+ $$REPORT_PATH/base/lrsimpleabstractfactory.h \
+ $$REPORT_PATH/base/lrattribsabstractfactory.h \
+ $$REPORT_PATH/serializators/lrserializatorintf.h \
+ $$REPORT_PATH/serializators/lrstorageintf.h \
+ $$REPORT_PATH/serializators/lrxmlqrectserializator.h \
+ $$REPORT_PATH/serializators/lrxmlserializatorsfactory.h \
+ $$REPORT_PATH/serializators/lrxmlbasetypesserializators.h \
+ $$REPORT_PATH/serializators/lrxmlreader.h \
+ $$REPORT_PATH/serializators/lrxmlwriter.h \
+ $$REPORT_PATH/lrbasedesignintf.h \
+ $$REPORT_PATH/lritemdesignintf.h \
+ $$REPORT_PATH/lrdesignelementsfactory.h \
+ $$REPORT_PATH/objectinspector/propertyItems/lrintpropitem.h \
+ $$REPORT_PATH/objectinspector/propertyItems/lrenumpropitem.h \
+ $$REPORT_PATH/objectinspector/propertyItems/lrboolpropitem.h \
+ $$REPORT_PATH/objectinspector/propertyItems/lrflagspropitem.h \
+ $$REPORT_PATH/objectinspector/editors/lrtextitempropertyeditor.h \
+ $$REPORT_PATH/objectinspector/editors/lrcomboboxeditor.h \
+ $$REPORT_PATH/objectinspector/editors/lrcheckboxeditor.h \
+ $$REPORT_PATH/objectinspector/editors/lrbuttonlineeditor.h \
+ $$REPORT_PATH/objectinspector/propertyItems/lrgroupfieldpropitem.h \
+ $$REPORT_PATH/objectsbrowser/lrobjectbrowser.h \
+ $$REPORT_PATH/items/lrtextitem.h \
+ $$REPORT_PATH/items/lrsubitemparentpropitem.h \
+ $$REPORT_PATH/items/lralignpropitem.h \
+ $$REPORT_PATH/items/lrhorizontallayout.h \
+ $$REPORT_PATH/items/editors/lritemeditorwidget.h \
+ $$REPORT_PATH/items/editors/lrfonteditorwidget.h \
+ $$REPORT_PATH/items/editors/lrtextalignmenteditorwidget.h \
+ $$REPORT_PATH/items/editors/lritemsaligneditorwidget.h \
+ $$REPORT_PATH/items/editors/lritemsborderseditorwidget.h \
+ $$REPORT_PATH/lrdatadesignintf.h \
+ $$REPORT_PATH/lrcollection.h \
+ $$REPORT_PATH/lrpagedesignintf.h \
+ $$REPORT_PATH/lrreportdesignwidget.h \
+ $$REPORT_PATH/lrreportengine_p.h \
+ $$REPORT_PATH/lrdatasourcemanager.h \
+ $$REPORT_PATH/lrreportdesignwindow.h \
+ $$REPORT_PATH/waitform.h \
+ $$REPORT_PATH/items/lrsimpletagparser.h \
+ $$REPORT_PATH/bands/lrsubdetailband.h \
+ $$REPORT_PATH/lrreportrender.h \
+ $$REPORT_PATH/lrpreviewreportwindow.h \
+ $$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.h \
+ $$REPORT_PATH/objectinspector/editors/lrfonteditor.h \
+ $$REPORT_PATH/items/lrimageitem.h \
+ $$REPORT_PATH/objectinspector/editors/lrimageeditor.h \
+ $$REPORT_PATH/objectinspector/propertyItems/lrimagepropitem.h \
+ $$REPORT_PATH/items/lrtextitemeditor.h \
+ $$REPORT_PATH/objectinspector/lrbasedesignobjectmodel.h \
+ $$REPORT_PATH/lrscriptenginemanager.h \
+ $$REPORT_PATH/objectinspector/propertyItems/lrqrealpropitem.h \
+ $$REPORT_PATH/items/lrshapeitem.h \
+ $$REPORT_PATH/objectinspector/editors/lrcoloreditor.h \
+ $$REPORT_PATH/objectinspector/propertyItems/lrcolorpropitem.h \
+ $$REPORT_PATH/bands/lrgroupbands.h \
+ $$REPORT_PATH/lrvariablesholder.h \
+ $$REPORT_PATH/lrgroupfunctions.h \
+ $$REPORT_PATH/lrreportengine.h \
+ $$REPORT_PATH/lrdatasourcemanagerintf.h \
+ $$REPORT_PATH/lrscriptenginemanagerintf.h \
+ $$REPORT_PATH/lrsimplecrypt.h \
+ $$REPORT_PATH/lraboutdialog.h \
+ $$REPORT_PATH/lrcallbackdatasourceintf.h
+
+contains(CONFIG,zint){
+ HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h
+}
+
+FORMS += \
+ $$REPORT_PATH/databrowser/lrsqleditdialog.ui \
+ $$REPORT_PATH/databrowser/lrconnectiondialog.ui \
+ $$REPORT_PATH/databrowser/lrdatabrowser.ui \
+ $$REPORT_PATH/databrowser/lrvariabledialog.ui \
+ $$REPORT_PATH/objectinspector/editors/ltextitempropertyeditor.ui \
+ $$REPORT_PATH/waitform.ui \
+ $$REPORT_PATH/lrpreviewreportwindow.ui \
+ $$REPORT_PATH/items/lrtextitemeditor.ui \
+ $$REPORT_PATH/lraboutdialog.ui
+
+RESOURCES += \
+ $$REPORT_PATH/objectinspector/lobjectinspector.qrc \
+ $$REPORT_PATH/databrowser/lrdatabrowser.qrc \
+ $$REPORT_PATH/report.qrc \
+ $$REPORT_PATH/items/items.qrc
diff --git a/report-lib_ru.ts b/report-lib_ru.ts
new file mode 100644
index 0000000..bc69495
--- /dev/null
+++ b/report-lib_ru.ts
@@ -0,0 +1,1466 @@
+
+
+
+
+ ConnectionDialog
+
+
+
+
+ Подключение
+
+
+
+
+ Название соединения
+
+
+
+
+ Драйвер
+
+
+
+
+ Сервер
+
+
+
+
+ Пользователь
+
+
+
+
+ Пароль
+
+
+
+
+ База данных
+
+
+
+
+
+
+
+
+
+ Авто соединение
+
+
+
+
+ Проверить соединение
+
+
+
+
+ Отмена
+
+
+
+
+
+
+
+
+
+
+ Ошибка
+
+
+
+
+ Соединение успешно установлено !
+
+
+
+
+ Название соединения не указано
+
+
+
+
+ Соединение с названием
+
+
+
+
+ уже существует
+
+
+
+ DataBrowser
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LRVariableDialog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::AVariablesHolder
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::AlignmentPropItem
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::ContentItemDesignIntf
+
+
+
+
+
+
+
+ LimeReport::DataBand
+
+
+
+
+
+
+
+ LimeReport::DataBrowser
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::DataSourceManager
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::DataSourceModel
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::FontEditorWidget
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::FontPropItem
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::GroupBandFooter
+
+
+
+
+
+
+
+ LimeReport::GroupBandHeader
+
+
+
+
+
+
+
+ LimeReport::GroupFunction
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::ItemsAlignmentEditorWidget
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::ItemsBordersEditorWidget
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::MasterDetailProxyModel
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::ModelToDataSource
+
+
+
+
+
+
+
+ LimeReport::ObjectBrowser
+
+
+
+
+
+
+
+ LimeReport::PageDesignIntf
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::PageFooter
+
+
+
+
+
+
+
+ LimeReport::PageHeader
+
+
+
+
+
+
+
+ LimeReport::QObjectPropertyModel
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::RectMMPropItem
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::RectPropItem
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::ReportDesignIntfPrivate
+
+
+
+
+
+
+
+ LimeReport::ReportDesignWidget
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::ReportDesignWindow
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::ReportFooter
+
+
+
+
+
+
+
+ LimeReport::ReportHeader
+
+
+
+
+
+
+
+ LimeReport::ReportRender
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::ScriptBrowser
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LimeReport::ScriptEngineContext
+
+
+
+
+
+
+
+ LimeReport::SubDetailBand
+
+
+
+
+
+
+
+ LimeReport::TextAlignmentEditorWidget
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreviewReportWindow
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ QObject
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SQLEditDialog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ScriptBrowser
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TextItemEditor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WaitForm
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/acollection.cpp b/src/acollection.cpp
new file mode 100644
index 0000000..5682a2b
--- /dev/null
+++ b/src/acollection.cpp
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "acollection.h"
diff --git a/src/areportpreviewwidget.h b/src/areportpreviewwidget.h
new file mode 100644
index 0000000..d36294e
--- /dev/null
+++ b/src/areportpreviewwidget.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef AREPORTPREVIEWINTF_H
+#define AREPORTPREVIEWINTF_H
+
+#include
+#include
+
+namespace ArReport{
+
+class ReportPreviewWidgetIntf : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit ReportPreviewWidgetIntf(QWidget *parent=0);
+private:
+ QGraphicsView* m_view;
+};
+
+}
+#endif // AREPORTPREVIEWINTF_H
diff --git a/src/bands/lrdataband.cpp b/src/bands/lrdataband.cpp
new file mode 100644
index 0000000..3e04c0e
--- /dev/null
+++ b/src/bands/lrdataband.cpp
@@ -0,0 +1,74 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrdataband.h"
+#include "lrdesignelementsfactory.h"
+#include "lrglobal.h"
+
+const QString xmlTag ="Data";
+
+namespace{
+
+LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::DataBand(owner,parent);
+}
+bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTag,
+ LimeReport::ItemAttribs(QObject::tr("Data"),LimeReport::bandTAG),
+ createBand
+ );
+
+}
+
+namespace LimeReport {
+
+DataBand::DataBand(QObject *owner, QGraphicsItem *parent)
+ : DataBandDesignIntf(LimeReport::BandDesignIntf::Data,xmlTag,owner,parent) {
+ setBandTypeText(tr("Data"));
+ setFixedPos(false);
+ setMarkerColor(bandColor());
+}
+
+bool DataBand::isUnique() const
+{
+ return false;
+}
+
+QColor DataBand::bandColor() const
+{
+ return QColor(Qt::darkGreen);
+}
+
+BaseDesignIntf *DataBand::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new DataBand(owner,parent);
+}
+
+}
+
diff --git a/src/bands/lrdataband.h b/src/bands/lrdataband.h
new file mode 100644
index 0000000..cd5b580
--- /dev/null
+++ b/src/bands/lrdataband.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRDATABAND_H
+#define LRDATABAND_H
+
+#include "lrbanddesignintf.h"
+#include "lrbasedesignintf.h"
+#include
+
+namespace LimeReport{
+class DataBand : public DataBandDesignIntf
+{
+ Q_OBJECT
+ Q_PROPERTY(bool keepSubdetailTogether READ tryToKeepTogether WRITE setTryToKeepTogether)
+ Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable )
+ Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether)
+ Q_PROPERTY(bool sliceLastRow READ sliceLastRow WRITE setSliceLastRow)
+public:
+ DataBand(QObject* owner = 0, QGraphicsItem* parent=0);
+ bool isUnique() const;
+ bool isData() const {return true;}
+protected:
+ QColor bandColor() const;
+private:
+ BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
+};
+}
+#endif // LRDATABAND_H
diff --git a/src/bands/lrgroupbands.cpp b/src/bands/lrgroupbands.cpp
new file mode 100644
index 0000000..54b559d
--- /dev/null
+++ b/src/bands/lrgroupbands.cpp
@@ -0,0 +1,156 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrgroupbands.h"
+#include "lrglobal.h"
+#include "lrdatasourcemanager.h"
+
+
+const QString xmlTagHeader = QLatin1String("GroupHeader");
+const QString xmlTagFooter = QLatin1String("GroupFooter");
+
+namespace{
+
+LimeReport::BaseDesignIntf* createHeader(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::GroupBandHeader(owner,parent);
+}
+
+bool registredHeader = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTagHeader,
+ LimeReport::ItemAttribs(QObject::tr("GroupHeader"),LimeReport::bandTAG),
+ createHeader
+ );
+
+LimeReport::BaseDesignIntf * createFooter(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::GroupBandFooter(owner,parent);
+}
+
+bool registredFooter = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTagFooter,
+ LimeReport::ItemAttribs(QObject::tr("GroupFooter"),LimeReport::bandTAG),
+ createFooter
+ );
+
+}
+
+namespace LimeReport{
+
+GroupBandHeader::GroupBandHeader(QObject *owner, QGraphicsItem *parent)
+ : BandDesignIntf(BandDesignIntf::GroupHeader, xmlTagHeader, owner,parent),
+ m_groupFiledName(""), m_groupStarted(false)
+{
+ setBandTypeText(tr("GroupHeader"));
+ setFixedPos(false);
+ setMarkerColor(bandColor());
+}
+
+bool GroupBandHeader::isUnique() const
+{
+ return false;
+}
+
+//bool GroupBandHeader::tryToKeepTogether()
+//{
+// return m_tryToKeepTogether;
+//}
+
+BaseDesignIntf *GroupBandHeader::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new GroupBandHeader(owner, parent);
+}
+
+void GroupBandHeader::startGroup()
+{
+ m_groupStarted=true;
+ DataSourceManager* dm = DataSourceManager::instance();
+ if ((dm->dataSource(parentBand()->datasourceName()))){
+ IDataSource* ds = dm->dataSource(parentBand()->datasourceName());
+ if (ds->columnIndexByName(m_groupFiledName)!=-1)
+ m_groupFieldValue=ds->data(m_groupFiledName);
+ }
+}
+
+QColor GroupBandHeader::bandColor() const
+{
+ return QColor(Qt::darkBlue);
+}
+
+bool GroupBandHeader::isNeedToClose()
+{
+ if (m_groupFieldValue.isNull()) return false;
+
+ DataSourceManager* dm = DataSourceManager::instance();
+ if ((dm->dataSource(parentBand()->datasourceName()))){
+ IDataSource* ds = dm->dataSource(parentBand()->datasourceName());
+ return ds->data(m_groupFiledName)!=m_groupFieldValue;
+ }
+
+ return false;
+}
+
+bool GroupBandHeader::isStarted()
+{
+ return !m_groupFieldValue.isNull();
+}
+
+void GroupBandHeader::closeGroup()
+{
+ m_groupFieldValue=QVariant();
+ m_groupStarted=false;
+}
+
+int GroupBandHeader::index()
+{
+ return bandIndex();
+}
+
+GroupBandFooter::GroupBandFooter(QObject *owner, QGraphicsItem *parent)
+ :BandDesignIntf(BandDesignIntf::GroupFooter, xmlTagFooter, owner,parent)
+{
+ setBandTypeText(tr("GroupFooter"));
+ setFixedPos(false);
+ setMarkerColor(bandColor());
+}
+
+bool GroupBandFooter::isUnique() const
+{
+ return false;
+}
+
+QColor GroupBandFooter::bandColor() const
+{
+ return QColor(Qt::darkBlue);
+}
+
+BaseDesignIntf *GroupBandFooter::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new GroupBandFooter(owner,parent);
+}
+
+} //namespace LimeReport
diff --git a/src/bands/lrgroupbands.h b/src/bands/lrgroupbands.h
new file mode 100644
index 0000000..8520408
--- /dev/null
+++ b/src/bands/lrgroupbands.h
@@ -0,0 +1,76 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRGROUPBANDS_H
+#define LRGROUPBANDS_H
+
+#include "lrbanddesignintf.h"
+#include "lrdesignelementsfactory.h"
+
+namespace LimeReport{
+
+class GroupBandHeader : public BandDesignIntf, public IGropBand{
+ Q_OBJECT
+ Q_PROPERTY(QString groupFieldName READ groupFieldName WRITE setGroupFieldName)
+ Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable )
+ Q_PROPERTY(bool keepGroupTogether READ tryToKeepTogether WRITE setTryToKeepTogether)
+public:
+ GroupBandHeader(QObject* owner = 0, QGraphicsItem* parent=0);
+ virtual bool isUnique() const;
+ QVariant groupFieldValue(){return m_groupFieldValue;}
+ void setGroupFieldValue(QVariant value){m_groupFieldValue=value;}
+ QString groupFieldName(){return m_groupFiledName;}
+ void setGroupFieldName(QString fieldName){m_groupFiledName=fieldName;}
+ QColor bandColor() const;
+private:
+ virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
+ virtual void startGroup();
+ virtual bool isNeedToClose();
+ virtual bool isStarted();
+ virtual void closeGroup();
+ virtual int index();
+private:
+ QVariant m_groupFieldValue;
+ QString m_groupFiledName;
+ bool m_groupStarted;
+};
+
+class GroupBandFooter : public BandDesignIntf{
+ Q_OBJECT
+public:
+ GroupBandFooter(QObject* owner = 0, QGraphicsItem* parent=0);
+ virtual bool isUnique() const;
+ QColor bandColor() const;
+ virtual bool isFooter() const{return true;}
+private:
+ virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
+};
+
+} // namespace LimeReport
+#endif // LRGROUPBANDS_H
diff --git a/src/bands/lrpagefooter.cpp b/src/bands/lrpagefooter.cpp
new file mode 100644
index 0000000..addefe7
--- /dev/null
+++ b/src/bands/lrpagefooter.cpp
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrpagefooter.h"
+#include "lrdesignelementsfactory.h"
+#include "lrglobal.h"
+
+const QString xmlTag ="PageFooter";
+
+namespace{
+LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::PageFooter(owner,parent);
+}
+
+bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTag,
+ LimeReport::ItemAttribs(QObject::tr("Page Footer"),LimeReport::bandTAG),
+ createBand
+ );
+}
+
+namespace LimeReport{
+
+PageFooter::PageFooter(QObject *owner, QGraphicsItem *parent)
+ : BandDesignIntf(LimeReport::BandDesignIntf::PageFooter,xmlTag,owner,parent) {
+ setBandTypeText( tr("Page Footer") );
+ setMarkerColor(bandColor());
+}
+
+BaseDesignIntf *PageFooter::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new PageFooter(owner,parent);
+}
+
+QColor PageFooter::bandColor() const
+{
+ return QColor(246,120,12);
+}
+
+} // namespace LimeReport
diff --git a/src/bands/lrpagefooter.h b/src/bands/lrpagefooter.h
new file mode 100644
index 0000000..8987317
--- /dev/null
+++ b/src/bands/lrpagefooter.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRPAGEFOOTER_H
+#define LRPAGEFOOTER_H
+
+#include "lrbanddesignintf.h"
+#include "lrbasedesignintf.h"
+#include
+
+namespace LimeReport{
+class PageFooter : public LimeReport::BandDesignIntf
+{
+ Q_OBJECT
+public:
+ PageFooter(QObject* owner = 0, QGraphicsItem* parent=0);
+ virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
+ virtual bool isFooter() const {return true;}
+protected:
+ QColor bandColor() const;
+};
+}
+
+#endif // LRPAGEFOOTER_H
diff --git a/src/bands/lrpageheader.cpp b/src/bands/lrpageheader.cpp
new file mode 100644
index 0000000..5b41734
--- /dev/null
+++ b/src/bands/lrpageheader.cpp
@@ -0,0 +1,70 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrpageheader.h"
+#include "lrdesignelementsfactory.h"
+#include "lrbanddesignintf.h"
+#include "lrbasedesignintf.h"
+#include "lrpageitemdesignintf.h"
+#include "lrglobal.h"
+
+const QString xmlTag ="PageHeader";
+
+namespace{
+
+LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::PageHeader(owner,parent);
+}
+
+bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTag,
+ LimeReport::ItemAttribs(QObject::tr("Page Header"),LimeReport::bandTAG),
+ createBand
+ );
+}
+
+namespace LimeReport{
+
+PageHeader::PageHeader(QObject* owner, QGraphicsItem *parent)
+: BandDesignIntf(LimeReport::BandDesignIntf::PageHeader,xmlTag,owner,parent) {
+ setBandTypeText(tr("Page Header"));
+ setMarkerColor(bandColor());
+}
+
+BaseDesignIntf *PageHeader::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new PageHeader(owner,parent);
+}
+
+QColor PageHeader::bandColor() const
+{
+ return QColor(246,120,12);
+}
+
+}
diff --git a/src/bands/lrpageheader.h b/src/bands/lrpageheader.h
new file mode 100644
index 0000000..dbbb6f5
--- /dev/null
+++ b/src/bands/lrpageheader.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRPAGEHEADER_H
+#define LRPAGEHEADER_H
+
+#include
+#include "lrbanddesignintf.h"
+#include "lrbasedesignintf.h"
+
+namespace LimeReport {
+class PageHeader : public LimeReport::BandDesignIntf
+{
+ Q_OBJECT
+public:
+ PageHeader(QObject* owner = 0, QGraphicsItem* parent=0);
+protected:
+ virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
+ QColor bandColor() const;
+};
+}
+#endif // LRPAGEHEADER_H
diff --git a/src/bands/lrreportfooter.cpp b/src/bands/lrreportfooter.cpp
new file mode 100644
index 0000000..66f6694
--- /dev/null
+++ b/src/bands/lrreportfooter.cpp
@@ -0,0 +1,71 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrreportfooter.h"
+#include "lrdesignelementsfactory.h"
+#include "lrglobal.h"
+
+const QString xmlTag ="ReportFooter";
+
+namespace{
+
+LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::ReportFooter(owner,parent);
+}
+bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTag,
+ LimeReport::ItemAttribs(QObject::tr("Report Footer"),LimeReport::bandTAG),
+ createBand
+ );
+}
+
+namespace LimeReport{
+
+ReportFooter::ReportFooter(QObject *owner, QGraphicsItem *parent)
+ : BandDesignIntf(LimeReport::BandDesignIntf::ReportFooter,xmlTag,owner,parent) {
+ setBandTypeText(tr("Report Footer"));
+ setMarkerColor(bandColor());
+}
+
+BaseDesignIntf *ReportFooter::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new ReportFooter(owner,parent);
+}
+
+QColor ReportFooter::bandColor() const
+{
+ return QColor(152,69,167);
+}
+
+bool ReportFooter::isFooter() const
+{
+ return true;
+}
+
+}
diff --git a/src/bands/lrreportfooter.h b/src/bands/lrreportfooter.h
new file mode 100644
index 0000000..140ad1e
--- /dev/null
+++ b/src/bands/lrreportfooter.h
@@ -0,0 +1,51 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRREPORTFOOTER_H
+#define LRREPORTFOOTER_H
+
+#include
+#include "lrbanddesignintf.h"
+#include "lrbasedesignintf.h"
+
+namespace LimeReport{
+class ReportFooter : public BandDesignIntf
+{
+ Q_OBJECT
+ Q_PROPERTY(int maxScalePercent READ maxScalePercent WRITE setMaxScalePercent)
+ Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable)
+public:
+ ReportFooter(QObject* owner=0, QGraphicsItem* parent=0);
+ virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
+protected:
+ QColor bandColor() const;
+ bool isFooter() const;
+};
+}
+#endif // LRREPORTFOOTER_H
diff --git a/src/bands/lrreportheader.cpp b/src/bands/lrreportheader.cpp
new file mode 100644
index 0000000..aa261fc
--- /dev/null
+++ b/src/bands/lrreportheader.cpp
@@ -0,0 +1,64 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrreportheader.h"
+#include "lrdesignelementsfactory.h"
+#include "lrglobal.h"
+
+const QString xmlTag ="ReportHeader";
+
+namespace{
+LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::ReportHeader(owner,parent);
+}
+bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTag,
+ LimeReport::ItemAttribs(QObject::tr("Report Header"),LimeReport::bandTAG),
+ createBand
+ );
+}
+namespace LimeReport {
+
+ReportHeader::ReportHeader(QObject *owner, QGraphicsItem *parent)
+ : BandDesignIntf(LimeReport::BandDesignIntf::ReportHeader,xmlTag,owner,parent) {
+ setBandTypeText(tr("Report Header"));
+ setMarkerColor(bandColor());
+}
+BaseDesignIntf *ReportHeader::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new ReportHeader(owner,parent);
+}
+
+QColor ReportHeader::bandColor() const
+{
+ return QColor(152,69,167);
+}
+
+}
+
diff --git a/src/bands/lrreportheader.h b/src/bands/lrreportheader.h
new file mode 100644
index 0000000..bc70667
--- /dev/null
+++ b/src/bands/lrreportheader.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRREPORTHEADER_H
+#define LRREPORTHEADER_H
+
+#include
+#include "lrbanddesignintf.h"
+#include "lrbasedesignintf.h"
+
+namespace LimeReport{
+class ReportHeader : public LimeReport::BandDesignIntf
+{
+ Q_OBJECT
+ Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable )
+public:
+ ReportHeader(QObject* owner = 0, QGraphicsItem *parent=0);
+ virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
+protected:
+ QColor bandColor() const;
+};
+}
+#endif // LRREPORTHEADER_H
diff --git a/src/bands/lrsubdetailband.cpp b/src/bands/lrsubdetailband.cpp
new file mode 100644
index 0000000..d1844fe
--- /dev/null
+++ b/src/bands/lrsubdetailband.cpp
@@ -0,0 +1,153 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrsubdetailband.h"
+#include "lrdesignelementsfactory.h"
+#include "lrglobal.h"
+
+
+const QString xmlTagBand = QLatin1String("SubDetail");
+const QString xmlTagHeader = QLatin1String("SubDetailHeader");
+const QString xmlTagFooter = QLatin1String("SubDetailFooter");
+const QColor BAND_COLOR = Qt::red;
+
+namespace{
+
+LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::SubDetailBand(owner,parent);
+}
+
+bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTagBand,
+ LimeReport::ItemAttribs(QObject::tr("SubDetail"),LimeReport::bandTAG),
+ createBand
+ );
+
+LimeReport::BaseDesignIntf * createHeader(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::SubDetailHeaderBand(owner,parent);
+}
+
+bool registredHeader = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTagHeader,
+ LimeReport::ItemAttribs(QObject::tr("SubDetailHeader"),LimeReport::bandTAG),
+ createHeader
+ );
+
+LimeReport::BaseDesignIntf * createFooter(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::SubDetailFooterBand(owner,parent);
+}
+
+bool registredFooter = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTagFooter,
+ LimeReport::ItemAttribs(QObject::tr("SubDetailFooter"),LimeReport::bandTAG),
+ createFooter
+ );
+
+} // namespace
+
+namespace LimeReport{
+
+//SubDetailBand
+
+SubDetailBand::SubDetailBand(QObject *owner, QGraphicsItem *parent)
+ : DataBandDesignIntf(BandDesignIntf::SubDetailBand, xmlTagBand, owner,parent)
+{
+ setBandTypeText(tr("SubDetail"));
+ setFixedPos(false);
+ setMarkerColor(bandColor());
+}
+
+bool SubDetailBand::isHasHeader() const
+{
+ return isConnectedToBand(BandDesignIntf::SubDetailHeader);
+}
+
+bool SubDetailBand::isHasFooter() const
+{
+ return isConnectedToBand(BandDesignIntf::SubDetailFooter);
+}
+
+BaseDesignIntf *SubDetailBand::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new SubDetailBand(owner,parent);
+}
+
+QColor SubDetailBand::bandColor() const
+{
+ return BAND_COLOR;
+}
+
+//SubDetailHeaderBand
+
+SubDetailHeaderBand::SubDetailHeaderBand(QObject *owner, QGraphicsItem *parent)
+ :BandDesignIntf(BandDesignIntf::SubDetailHeader,xmlTagHeader,owner,parent), m_printAlways(false)
+{
+ setMarkerColor(bandColor());
+}
+
+bool SubDetailHeaderBand::isUnique() const
+{
+ return false;
+}
+
+QColor SubDetailHeaderBand::bandColor() const
+{
+ return BAND_COLOR;
+}
+
+BaseDesignIntf *SubDetailHeaderBand::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new SubDetailHeaderBand(owner,parent);
+}
+
+//SubDetailFooterBand
+
+SubDetailFooterBand::SubDetailFooterBand(QObject *owner, QGraphicsItem *parent)
+ : BandDesignIntf(BandDesignIntf::SubDetailFooter,xmlTagFooter,owner,parent), m_printAlways(false)
+{
+ setMarkerColor(bandColor());
+}
+
+bool SubDetailFooterBand::isUnique() const
+{
+ return false;
+}
+
+QColor SubDetailFooterBand::bandColor() const
+{
+ return BAND_COLOR;
+}
+
+BaseDesignIntf *SubDetailFooterBand::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new SubDetailFooterBand(owner,parent);
+}
+
+
+}
diff --git a/src/bands/lrsubdetailband.h b/src/bands/lrsubdetailband.h
new file mode 100644
index 0000000..3bfe1b4
--- /dev/null
+++ b/src/bands/lrsubdetailband.h
@@ -0,0 +1,89 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRSUBDETAILBAND_H
+#define LRSUBDETAILBAND_H
+
+#include "lrbanddesignintf.h"
+#include "lrbasedesignintf.h"
+
+namespace LimeReport{
+
+class SubDetailBand : public DataBandDesignIntf
+{
+ Q_OBJECT
+ Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable)
+public:
+ SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0);
+ bool isUnique() const {return false;}
+ bool isHasHeader() const;
+ bool isHasFooter() const;
+private:
+ virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
+protected:
+ virtual QColor bandColor() const;
+};
+
+class SubDetailHeaderBand : public BandDesignIntf
+{
+ Q_OBJECT
+ Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways())
+public:
+ SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0);
+ virtual bool isUnique() const;
+ void setPrintAlways(bool value){m_printAlways=value;}
+ bool printAlways(){return m_printAlways;}
+protected:
+ virtual QColor bandColor() const;
+private:
+ virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
+private:
+ bool m_printAlways;
+};
+
+class SubDetailFooterBand : public BandDesignIntf
+{
+ Q_OBJECT
+ Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways())
+public:
+ SubDetailFooterBand(QObject* owner = 0, QGraphicsItem* parent=0);
+ void setPrintAlways(bool value){m_printAlways=value;}
+ bool printAlways(){return m_printAlways;}
+ virtual bool isUnique() const;
+ virtual bool isFooter() const{return true;}
+protected:
+ virtual QColor bandColor() const;
+private:
+ virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
+private:
+ bool m_printAlways;
+};
+
+}
+#endif // LRSUBDETAILBAND_H
diff --git a/src/base/lrattribsabstractfactory.h b/src/base/lrattribsabstractfactory.h
new file mode 100644
index 0000000..d760aa5
--- /dev/null
+++ b/src/base/lrattribsabstractfactory.h
@@ -0,0 +1,82 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRATTRIBABSTRACTFACTORY_H
+#define LRATTRIBABSTRACTFACTORY_H
+
+#include "lrsingleton.h"
+#include "lrglobal.h"
+#include
+#include
+#include
+
+namespace LimeReport{
+
+template
+<
+ typename AbstractProduct,
+ typename IdentifierType,
+ typename ProductCreator,
+ typename Attribs
+>
+class AttribsAbstractFactory
+ : public Singleton< AttribsAbstractFactory< AbstractProduct,IdentifierType,ProductCreator,Attribs > >
+{
+private:
+ typedef QMap FactoryMap;
+ typedef QMap AliasMap;
+ friend class Singleton< AttribsAbstractFactory< AbstractProduct,IdentifierType,ProductCreator,Attribs > >;
+public:
+ bool registerCreator(const IdentifierType& id, Attribs attribs, ProductCreator creator){
+ return (m_factoryMap.insert(id,creator).value()==creator)&&
+ (m_attribsMap.insert(id,attribs).value()==attribs);
+ }
+ bool unregisterCreator(const IdentifierType& id){
+ return (m_factoryMap.remove(id)==1)&&(m_attribsMap.remove(id)==1);
+ }
+ ProductCreator objectCreator(const IdentifierType& id){
+ if (m_factoryMap.contains(id)){
+ return m_factoryMap[id];
+ } else return 0;
+ }
+ QString attribs(const IdentifierType& id){
+ if (m_attribsMap.contains(id)){
+ return m_attribsMap.value(id);
+ } else return "";
+ }
+ const FactoryMap& map(){return m_factoryMap;}
+ const AliasMap& attribsMap(){return m_attribsMap;}
+ int mapElementCount(){return m_factoryMap.count();}
+private:
+ FactoryMap m_factoryMap;
+ AliasMap m_attribsMap;
+};
+
+}
+#endif // LRATTRIBABSTRACTFACTORY_H
diff --git a/src/base/lrsimpleabstractfactory.h b/src/base/lrsimpleabstractfactory.h
new file mode 100644
index 0000000..3722a8b
--- /dev/null
+++ b/src/base/lrsimpleabstractfactory.h
@@ -0,0 +1,103 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRSIMPLEABSTRACTFACTORY_H
+#define LRSIMPLEABSTRACTFACTORY_H
+
+#include "lrsingleton.h"
+#include "lrglobal.h"
+#include
+#include
+#include
+#include
+namespace LimeReport{
+
+template
+<
+ typename AbstractProduct,
+ typename IdentifierType,
+ typename ProductCreator
+>
+class SimpleAbstractFactory
+ : public Singleton< SimpleAbstractFactory< AbstractProduct,IdentifierType,ProductCreator > >
+{
+private:
+ typedef QHash FactoryMap;
+ friend class Singleton< SimpleAbstractFactory< AbstractProduct,IdentifierType,ProductCreator > >;
+public:
+ bool registerCreator(const IdentifierType& id, ProductCreator creator){
+ return (m_factoryMap.insert(id,creator).value()==creator);
+ }
+ bool unregisterCreator(const IdentifierType& id){
+ return (m_factoryMap.remove(id)==1);
+ }
+ ProductCreator objectCreator(const IdentifierType& id){
+ if (m_factoryMap.contains(id)){
+ return m_factoryMap[id];
+ } else {
+ return 0;
+ }
+ }
+ const FactoryMap& map(){return m_factoryMap;}
+ int mapElementCount(){return m_factoryMap.count();}
+private:
+ FactoryMap m_factoryMap;
+};
+
+template
+<
+ typename AbstractProduct,
+ typename IdentifierType,
+ typename ProductCreator,
+ typename Attribs
+>
+class AttribAbstractFactory : public SimpleAbstractFactory< AbstractProduct,IdentifierType,ProductCreator >{
+ typedef SimpleAbstractFactory< AbstractProduct,IdentifierType,ProductCreator > SimpleFactory;
+ typedef QMap AliasMap;
+ friend class Singleton >;
+public :
+ bool registerCreator(const IdentifierType &id, Attribs attribs, ProductCreator creator){
+ return SimpleFactory::registerCreator(id,creator) && (m_attribsMap.insert(id,attribs).value()==attribs);
+ }
+ bool unregisterCreator(const IdentifierType &id){
+ return SimpleFactory::unregisterCreator(id)&&(m_attribsMap.remove(id)==1);
+ }
+ QString attribs(const IdentifierType& id){
+ if (m_attribsMap.contains(id)){
+ return m_attribsMap.value(id);
+ } else return "";
+ }
+ const AliasMap& attribsMap(){return m_attribsMap;}
+private:
+ AliasMap m_attribsMap;
+};
+
+}
+
+#endif //LRSIMPLEABSTRACTFACTORY_H
diff --git a/src/base/lrsingleton.h b/src/base/lrsingleton.h
new file mode 100644
index 0000000..f011872
--- /dev/null
+++ b/src/base/lrsingleton.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRSINGLETON_H
+#define LRSINGLETON_H
+
+#include
+
+namespace LimeReport{
+
+template
+class Singleton
+{
+public:
+ static T& instance(){
+ if (0==inst){
+ inst = new T();
+ ::atexit( destroy );
+ } else {};
+ return *inst;
+ }
+private:
+ static T* inst;
+private:
+ static void destroy() {
+ delete inst;
+ }
+};
+
+template
+T* Singleton< T >::inst =0;
+}
+#endif // LRSINGLETON_H
diff --git a/src/databrowser/images/add.png b/src/databrowser/images/add.png
new file mode 100644
index 0000000..7ab3357
Binary files /dev/null and b/src/databrowser/images/add.png differ
diff --git a/src/databrowser/images/check.png b/src/databrowser/images/check.png
new file mode 100644
index 0000000..3bde53b
Binary files /dev/null and b/src/databrowser/images/check.png differ
diff --git a/src/databrowser/images/check_circle.png b/src/databrowser/images/check_circle.png
new file mode 100644
index 0000000..7fe467b
Binary files /dev/null and b/src/databrowser/images/check_circle.png differ
diff --git a/src/databrowser/images/cursor-small.png b/src/databrowser/images/cursor-small.png
new file mode 100644
index 0000000..7643a54
Binary files /dev/null and b/src/databrowser/images/cursor-small.png differ
diff --git a/src/databrowser/images/data.png b/src/databrowser/images/data.png
new file mode 100644
index 0000000..65007f7
Binary files /dev/null and b/src/databrowser/images/data.png differ
diff --git a/src/databrowser/images/data1.png b/src/databrowser/images/data1.png
new file mode 100644
index 0000000..cf5baca
Binary files /dev/null and b/src/databrowser/images/data1.png differ
diff --git a/src/databrowser/images/data_add.png b/src/databrowser/images/data_add.png
new file mode 100644
index 0000000..4525abc
Binary files /dev/null and b/src/databrowser/images/data_add.png differ
diff --git a/src/databrowser/images/data_add1.png b/src/databrowser/images/data_add1.png
new file mode 100644
index 0000000..e7c035d
Binary files /dev/null and b/src/databrowser/images/data_add1.png differ
diff --git a/src/databrowser/images/data_delete.png b/src/databrowser/images/data_delete.png
new file mode 100644
index 0000000..338a456
Binary files /dev/null and b/src/databrowser/images/data_delete.png differ
diff --git a/src/databrowser/images/data_delete1.png b/src/databrowser/images/data_delete1.png
new file mode 100644
index 0000000..f84b18c
Binary files /dev/null and b/src/databrowser/images/data_delete1.png differ
diff --git a/src/databrowser/images/data_edit.png b/src/databrowser/images/data_edit.png
new file mode 100644
index 0000000..9a51969
Binary files /dev/null and b/src/databrowser/images/data_edit.png differ
diff --git a/src/databrowser/images/data_edit1.png b/src/databrowser/images/data_edit1.png
new file mode 100644
index 0000000..21f64c0
Binary files /dev/null and b/src/databrowser/images/data_edit1.png differ
diff --git a/src/databrowser/images/database_connect.png b/src/databrowser/images/database_connect.png
new file mode 100644
index 0000000..0628985
Binary files /dev/null and b/src/databrowser/images/database_connect.png differ
diff --git a/src/databrowser/images/database_connected.png b/src/databrowser/images/database_connected.png
new file mode 100644
index 0000000..a9afa58
Binary files /dev/null and b/src/databrowser/images/database_connected.png differ
diff --git a/src/databrowser/images/database_connected2.png b/src/databrowser/images/database_connected2.png
new file mode 100644
index 0000000..d5e1022
Binary files /dev/null and b/src/databrowser/images/database_connected2.png differ
diff --git a/src/databrowser/images/database_connected3.png b/src/databrowser/images/database_connected3.png
new file mode 100644
index 0000000..af832d4
Binary files /dev/null and b/src/databrowser/images/database_connected3.png differ
diff --git a/src/databrowser/images/database_disconnect.png b/src/databrowser/images/database_disconnect.png
new file mode 100644
index 0000000..20ff200
Binary files /dev/null and b/src/databrowser/images/database_disconnect.png differ
diff --git a/src/databrowser/images/edit_table.png b/src/databrowser/images/edit_table.png
new file mode 100644
index 0000000..4596124
Binary files /dev/null and b/src/databrowser/images/edit_table.png differ
diff --git a/src/databrowser/images/error.png b/src/databrowser/images/error.png
new file mode 100644
index 0000000..9cee887
Binary files /dev/null and b/src/databrowser/images/error.png differ
diff --git a/src/databrowser/images/error_message.png b/src/databrowser/images/error_message.png
new file mode 100644
index 0000000..6c80de1
Binary files /dev/null and b/src/databrowser/images/error_message.png differ
diff --git a/src/databrowser/images/error_message_2.png b/src/databrowser/images/error_message_2.png
new file mode 100644
index 0000000..015d23c
Binary files /dev/null and b/src/databrowser/images/error_message_2.png differ
diff --git a/src/databrowser/images/field.png b/src/databrowser/images/field.png
new file mode 100644
index 0000000..da58806
Binary files /dev/null and b/src/databrowser/images/field.png differ
diff --git a/src/databrowser/images/greenled.png b/src/databrowser/images/greenled.png
new file mode 100644
index 0000000..0e10788
Binary files /dev/null and b/src/databrowser/images/greenled.png differ
diff --git a/src/databrowser/images/note_edit.png b/src/databrowser/images/note_edit.png
new file mode 100644
index 0000000..c199961
Binary files /dev/null and b/src/databrowser/images/note_edit.png differ
diff --git a/src/databrowser/images/plug-connect.png b/src/databrowser/images/plug-connect.png
new file mode 100644
index 0000000..7af930e
Binary files /dev/null and b/src/databrowser/images/plug-connect.png differ
diff --git a/src/databrowser/images/plug-disconnect-slash.png b/src/databrowser/images/plug-disconnect-slash.png
new file mode 100644
index 0000000..6010982
Binary files /dev/null and b/src/databrowser/images/plug-disconnect-slash.png differ
diff --git a/src/databrowser/images/plug-disconnect.png b/src/databrowser/images/plug-disconnect.png
new file mode 100644
index 0000000..ce71853
Binary files /dev/null and b/src/databrowser/images/plug-disconnect.png differ
diff --git a/src/databrowser/images/pointer.png b/src/databrowser/images/pointer.png
new file mode 100644
index 0000000..ea87a66
Binary files /dev/null and b/src/databrowser/images/pointer.png differ
diff --git a/src/databrowser/images/remove.png b/src/databrowser/images/remove.png
new file mode 100644
index 0000000..afbb0ee
Binary files /dev/null and b/src/databrowser/images/remove.png differ
diff --git a/src/databrowser/images/row.png b/src/databrowser/images/row.png
new file mode 100644
index 0000000..b1971ba
Binary files /dev/null and b/src/databrowser/images/row.png differ
diff --git a/src/databrowser/images/table.png b/src/databrowser/images/table.png
new file mode 100644
index 0000000..30916b5
Binary files /dev/null and b/src/databrowser/images/table.png differ
diff --git a/src/databrowser/images/table_add.png b/src/databrowser/images/table_add.png
new file mode 100644
index 0000000..c10db3e
Binary files /dev/null and b/src/databrowser/images/table_add.png differ
diff --git a/src/databrowser/images/table_db.png b/src/databrowser/images/table_db.png
new file mode 100644
index 0000000..fa41658
Binary files /dev/null and b/src/databrowser/images/table_db.png differ
diff --git a/src/databrowser/images/table_delete.png b/src/databrowser/images/table_delete.png
new file mode 100644
index 0000000..e2655d9
Binary files /dev/null and b/src/databrowser/images/table_delete.png differ
diff --git a/src/databrowser/images/table_delete1.png b/src/databrowser/images/table_delete1.png
new file mode 100644
index 0000000..1dbc388
Binary files /dev/null and b/src/databrowser/images/table_delete1.png differ
diff --git a/src/databrowser/images/table_edit.png b/src/databrowser/images/table_edit.png
new file mode 100644
index 0000000..1d348b1
Binary files /dev/null and b/src/databrowser/images/table_edit.png differ
diff --git a/src/databrowser/images/table_error.png b/src/databrowser/images/table_error.png
new file mode 100644
index 0000000..bbf8909
Binary files /dev/null and b/src/databrowser/images/table_error.png differ
diff --git a/src/databrowser/images/table_error1.png b/src/databrowser/images/table_error1.png
new file mode 100644
index 0000000..3976928
Binary files /dev/null and b/src/databrowser/images/table_error1.png differ
diff --git a/src/databrowser/images/table_good.png b/src/databrowser/images/table_good.png
new file mode 100644
index 0000000..3883f46
Binary files /dev/null and b/src/databrowser/images/table_good.png differ
diff --git a/src/databrowser/images/table_good1.png b/src/databrowser/images/table_good1.png
new file mode 100644
index 0000000..d175d33
Binary files /dev/null and b/src/databrowser/images/table_good1.png differ
diff --git a/src/databrowser/images/table_view.png b/src/databrowser/images/table_view.png
new file mode 100644
index 0000000..592de5d
Binary files /dev/null and b/src/databrowser/images/table_view.png differ
diff --git a/src/databrowser/images/table_view1.png b/src/databrowser/images/table_view1.png
new file mode 100644
index 0000000..8f8c83c
Binary files /dev/null and b/src/databrowser/images/table_view1.png differ
diff --git a/src/databrowser/images/value.png b/src/databrowser/images/value.png
new file mode 100644
index 0000000..6c4b820
Binary files /dev/null and b/src/databrowser/images/value.png differ
diff --git a/src/databrowser/images/value1.png b/src/databrowser/images/value1.png
new file mode 100644
index 0000000..c255914
Binary files /dev/null and b/src/databrowser/images/value1.png differ
diff --git a/src/databrowser/images/value_add.png b/src/databrowser/images/value_add.png
new file mode 100644
index 0000000..5261b39
Binary files /dev/null and b/src/databrowser/images/value_add.png differ
diff --git a/src/databrowser/images/value_add1.png b/src/databrowser/images/value_add1.png
new file mode 100644
index 0000000..fd3ecce
Binary files /dev/null and b/src/databrowser/images/value_add1.png differ
diff --git a/src/databrowser/images/value_add2.png b/src/databrowser/images/value_add2.png
new file mode 100644
index 0000000..5e6b9cc
Binary files /dev/null and b/src/databrowser/images/value_add2.png differ
diff --git a/src/databrowser/images/value_delete.png b/src/databrowser/images/value_delete.png
new file mode 100644
index 0000000..7038ead
Binary files /dev/null and b/src/databrowser/images/value_delete.png differ
diff --git a/src/databrowser/images/value_delete1.png b/src/databrowser/images/value_delete1.png
new file mode 100644
index 0000000..832b392
Binary files /dev/null and b/src/databrowser/images/value_delete1.png differ
diff --git a/src/databrowser/images/value_edit.png b/src/databrowser/images/value_edit.png
new file mode 100644
index 0000000..1464941
Binary files /dev/null and b/src/databrowser/images/value_edit.png differ
diff --git a/src/databrowser/images/value_edit1.png b/src/databrowser/images/value_edit1.png
new file mode 100644
index 0000000..70d340a
Binary files /dev/null and b/src/databrowser/images/value_edit1.png differ
diff --git a/src/databrowser/images/value_edit2.png b/src/databrowser/images/value_edit2.png
new file mode 100644
index 0000000..2cd4d7c
Binary files /dev/null and b/src/databrowser/images/value_edit2.png differ
diff --git a/src/databrowser/lrconnectiondialog.cpp b/src/databrowser/lrconnectiondialog.cpp
new file mode 100644
index 0000000..1676c82
--- /dev/null
+++ b/src/databrowser/lrconnectiondialog.cpp
@@ -0,0 +1,149 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrconnectiondialog.h"
+#include "ui_lrconnectiondialog.h"
+#include "lrglobal.h"
+#include
+#include
+#include
+#include
+#include
+#include
+
+ConnectionDialog::ConnectionDialog(LimeReport::IConnectionController *conControl, LimeReport::ConnectionDesc* connectionDesc, QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::ConnectionDialog),m_connection(connectionDesc),m_controller(conControl)
+{
+ ui->setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose,true);
+ m_changeMode=m_connection!=0;
+}
+
+ConnectionDialog::~ConnectionDialog()
+{
+ delete ui;
+}
+
+void ConnectionDialog::init()
+{
+ ui->cbbDrivers->addItems(QSqlDatabase::drivers());
+}
+
+void ConnectionDialog::showEvent(QShowEvent *)
+{
+ connectionToUI();
+}
+
+void ConnectionDialog::slotAccept()
+{
+ try {
+ checkFieldsFill();
+ if (ui->cbAutoConnect->isChecked()) checkConnection();
+ if (!m_connection){
+ m_controller->addConnectionDesc(uiToConnection());
+ } else {
+ m_controller->changeConnectionDesc(uiToConnection());
+ }
+ close();
+ }
+ catch(LimeReport::ReportError &exception){
+ QMessageBox::critical(this,tr("Error"),exception.what());
+ }
+}
+
+void ConnectionDialog::slotCheckConnection()
+{
+ try{
+ checkConnection();
+ QMessageBox::information(this,tr("Connection"),tr("Connection succsesfully established!"));
+ } catch(LimeReport::ReportError &exception) {
+ QMessageBox::critical(this,tr("Error"),exception.what());
+ }
+}
+
+void ConnectionDialog::checkFieldsFill()
+{
+ if (ui->leConnectionName->text().isEmpty()){throw LimeReport::ReportError(tr("Connection Name is empty"));}
+ if (!m_changeMode&&QSqlDatabase::connectionNames().contains(ui->leConnectionName->text())) {
+ throw LimeReport::ReportError(tr("Connection with name ")+ui->leConnectionName->text()+tr(" already exists "));
+ }
+}
+
+bool ConnectionDialog::checkConnection()
+{
+ bool connectionEstablished = false;
+ QString lastError;
+ {
+ QSqlDatabase db = QSqlDatabase::addDatabase(ui->cbbDrivers->currentText(),ui->leConnectionName->text()+"_check");
+ db.setHostName(ui->leServerName->text());
+ db.setUserName(ui->leUserName->text());
+ db.setDatabaseName(ui->leDataBase->text());
+ db.setPassword(ui->lePassword->text());
+ connectionEstablished = db.open();
+ if (!db.open()) {
+ lastError=db.lastError().text();
+ }
+ }
+ QSqlDatabase::removeDatabase(ui->leConnectionName->text()+"_check");
+ if (!connectionEstablished) throw LimeReport::ReportError(lastError);
+ return true;
+}
+
+LimeReport::ConnectionDesc *ConnectionDialog::uiToConnection()
+{
+ if (!m_connection) m_connection = new LimeReport::ConnectionDesc();
+ m_connection->setName(ui->leConnectionName->text());
+ m_connection->setHost(ui->leServerName->text());
+ m_connection->setDriver(ui->cbbDrivers->currentText());
+ m_connection->setUserName(ui->leUserName->text());
+ m_connection->setPassword(ui->lePassword->text());
+ m_connection->setDatabaseName(ui->leDataBase->text());
+ m_connection->setAutoconnect(ui->cbAutoConnect->isChecked());
+ return m_connection;
+}
+
+void ConnectionDialog::connectionToUI()
+{
+ init();
+ if (!m_connection) return;
+ ui->leConnectionName->setText(m_connection->name());
+ ui->leDataBase->setText(m_connection->databaseName());
+ ui->leServerName->setText(m_connection->host());
+ ui->leUserName->setText(m_connection->userName());
+ ui->lePassword->setText(m_connection->password());
+ ui->cbbDrivers->setCurrentIndex(ui->cbbDrivers->findText(m_connection->driver()));
+ ui->cbAutoConnect->setChecked(m_connection->autoconnect());
+}
+
+
+void ConnectionDialog::on_toolButton_clicked()
+{
+ ui->leDataBase->setText(QFileDialog::getOpenFileName());
+}
diff --git a/src/databrowser/lrconnectiondialog.h b/src/databrowser/lrconnectiondialog.h
new file mode 100644
index 0000000..7d22dd9
--- /dev/null
+++ b/src/databrowser/lrconnectiondialog.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRCONNECTIONDIALOG_H
+#define LRCONNECTIONDIALOG_H
+
+#include
+#include "lrdatadesignintf.h"
+
+namespace Ui {
+ class ConnectionDialog;
+}
+
+class ConnectionDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit ConnectionDialog(LimeReport::IConnectionController* conControl, LimeReport::ConnectionDesc* connectionDesc=0, QWidget *parent = 0);
+ ~ConnectionDialog();
+protected:
+ void showEvent(QShowEvent *);
+ void init();
+ void checkFieldsFill();
+ bool checkConnection();
+ LimeReport::ConnectionDesc* uiToConnection();
+ void connectionToUI();
+signals:
+ void conectionRegistred(LimeReport::ConnectionDesc* connectionDesc);
+private slots:
+ void slotAccept();
+ void slotCheckConnection();
+ void on_toolButton_clicked();
+
+private:
+ Ui::ConnectionDialog *ui;
+ LimeReport::ConnectionDesc* m_connection;
+ bool m_changeMode;
+ LimeReport::IConnectionController* m_controller;
+};
+
+#endif // LRCONNECTIONDIALOG_H
diff --git a/src/databrowser/lrconnectiondialog.ui b/src/databrowser/lrconnectiondialog.ui
new file mode 100644
index 0000000..b292cf5
--- /dev/null
+++ b/src/databrowser/lrconnectiondialog.ui
@@ -0,0 +1,249 @@
+
+
+ ConnectionDialog
+
+
+
+ 0
+ 0
+ 420
+ 294
+
+
+
+ Connection
+
+
+
+ :/databrowser/images/database_disconnected:/databrowser/images/database_disconnected
+
+
+
+
+
+
+
+ Connection Name
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Driver
+
+
+
+
+
+
+
+
+
+ Server
+
+
+
+
+
+
+
+
+
+
+
+
+
+ User
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Password
+
+
+
+
+
+
+
+
+
+ QLineEdit::Password
+
+
+
+
+
+
+ Database
+
+
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ ...
+
+
+
+
+
+
+
+
+
+
+ Auto connect
+
+
+
+
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 0
+
+
+
+
+
+
+
+
+
+ Check connection
+
+
+ false
+
+
+
+
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+ Cancel
+
+
+ false
+
+
+
+
+
+
+ Ok
+
+
+
+
+
+
+
+
+
+
+
+
+ pbOk
+ clicked()
+ ConnectionDialog
+ slotAccept()
+
+
+ 388
+ 266
+
+
+ 376
+ 215
+
+
+
+
+ pbCancel
+ clicked()
+ ConnectionDialog
+ reject()
+
+
+ 268
+ 263
+
+
+ 255
+ 225
+
+
+
+
+ pbCheckConnection
+ clicked()
+ ConnectionDialog
+ slotCheckConnection()
+
+
+ 28
+ 271
+
+
+ 36
+ 224
+
+
+
+
+
+ slotAccept()
+ slotCheckConnection()
+
+
diff --git a/src/databrowser/lrdatabrowser.cpp b/src/databrowser/lrdatabrowser.cpp
new file mode 100644
index 0000000..4bd07cb
--- /dev/null
+++ b/src/databrowser/lrdatabrowser.cpp
@@ -0,0 +1,705 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "ui_lrdatabrowser.h"
+
+#include "lrdatabrowser.h"
+#include "lrsqleditdialog.h"
+#include "lrconnectiondialog.h"
+#include "lrreportengine_p.h"
+#include "lrvariabledialog.h"
+#include "lrdatabrowsertree.h"
+
+namespace LimeReport{
+
+DataBrowser::DataBrowser(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::DataBrowser), m_report(0), m_closingWindows(false), m_settings(0), m_ownedSettings(false)
+{
+ ui->setupUi(this);
+ connect(ui->addConnection,SIGNAL(clicked()),this,SLOT(slotAddConnection()));
+ connect(ui->deleteConection,SIGNAL(clicked()),this,SLOT(slotDeleteConnection()));
+ connect(ui->addDataSource,SIGNAL(clicked()),this,SLOT(slotAddDataSource()));
+ connect(ui->viewDataSource,SIGNAL(clicked()),this,SLOT(slotViewDatasource()));
+ connect(ui->editDataSource,SIGNAL(clicked()),this,SLOT(slotEditDatasource()));
+ connect(ui->deleteDataSource,SIGNAL(clicked()),this,SLOT(slotDeleteDatasource()));
+ connect(ui->changeConnection,SIGNAL(clicked()),this,SLOT(slotChangeConnection()));
+ connect(ui->pbConnect,SIGNAL(clicked()),this,SLOT(slotChangeConnectionState()));
+
+ ui->dataTree->setHeaderLabel(tr("Datasources"));
+ ui->pbConnect->setEnabled(false);
+}
+
+DataBrowser::~DataBrowser()
+{
+ delete ui;
+ if (m_settings && m_ownedSettings)
+ delete m_settings;
+}
+QSize DataBrowser::sizeHint() const
+{
+ return QSize(100,200);
+}
+
+void DataBrowser::slotAddConnection()
+{
+ ConnectionDialog *connectionEdit = new ConnectionDialog(this,0,this);
+ connectionEdit->setAttribute(Qt::WA_DeleteOnClose,true);
+#if defined(WIN32) || defined(WIN64)
+ connectionEdit->setWindowModality(Qt::ApplicationModal);
+#else
+ connectionEdit->setWindowModality(Qt::WindowModal);
+#endif
+ //connect(connectionEdit,SIGNAL(finished(int)),this,SLOT(slotConnectionEditFinished(int)));
+ //connect(connectionEdit,SIGNAL(conectionRegistred(QString)),this,SLOT(slotConnectionRegistred(QString)));
+ connectionEdit->exec();
+}
+
+void DataBrowser::slotSQLEditingFinished(SQLEditResult result)
+{
+ if (result.dialogMode==SQLEditDialog::AddMode) {
+ switch (result.resultMode) {
+ case SQLEditResult::Query:
+ addQuery(result);
+ break;
+ case SQLEditResult::SubQuery:
+ addSubQuery(result);
+ break;
+ case SQLEditResult::SubProxy:
+ addProxy(result);
+ default:
+ break;
+ }
+ } else {
+ switch(result.resultMode){
+ case SQLEditResult::Query:
+ changeQuery(result);
+ break;
+ case SQLEditResult::SubQuery:
+ changeSubQuery(result);
+ break;
+ case SQLEditResult::SubProxy:
+ changeProxy(result);
+ }
+ }
+
+ updateDataTree();
+}
+
+void DataBrowser::slotDeleteConnection()
+{
+ if (!getConnectionName().isEmpty()){
+ if (
+ QMessageBox::critical(
+ this,
+ tr("Attention"),
+ tr("Do you really want delete \"%1\" connection ?").arg(getConnectionName()),
+ QMessageBox::Ok|QMessageBox::No,
+ QMessageBox::No
+ )==QMessageBox::Ok
+ ){
+ m_report->dataManager()->removeConnection(getConnectionName());
+ updateDataTree();
+ }
+ }
+}
+
+void DataBrowser::slotAddDataSource()
+{
+ SQLEditDialog *sqlEdit = new SQLEditDialog(this,m_report->dataManager(),SQLEditDialog::AddMode);
+ sqlEdit->setAttribute(Qt::WA_DeleteOnClose,true);
+#if defined(WIN64) || defined(WIN32)
+ sqlEdit->setWindowModality(Qt::ApplicationModal);
+#else
+ sqlEdit->setWindowModality(Qt::WindowModal);
+#endif
+ sqlEdit->setSettings(settings());
+ sqlEdit->setDataSources(m_report->dataManager());
+ sqlEdit->setDefaultConnection(getConnectionName());
+ connect(sqlEdit,SIGNAL(signalSqlEditingFinished(SQLEditResult)),this,SLOT(slotSQLEditingFinished(SQLEditResult)));
+ sqlEdit->exec();
+}
+
+void DataBrowser::updateDataTree()
+{
+ QString selectedText = "";
+ int selectedType = 0;
+
+ if (ui->dataTree->selectedItems().count()==1){
+ selectedType = ui->dataTree->selectedItems().at(0)->type();
+ selectedText = ui->dataTree->selectedItems().at(0)->text(0);
+ }
+
+ initConnections();
+
+ foreach(QString dataSourceName, m_report->datasourcesNames()){
+
+ QTreeWidgetItem *item=new QTreeWidgetItem(QStringList(dataSourceName),DataBrowserTree::Table);
+ QTreeWidgetItem *parentItem = findByNameAndType(m_report->dataManager()->connectionName(dataSourceName),DataBrowserTree::Connection);
+ if (parentItem){
+ parentItem->addChild(item);
+ if (!parentItem->isExpanded()) ui->dataTree->expandItem(parentItem);
+ } else {
+ ui->dataTree->addTopLevelItem(item);
+ }
+
+ try{
+ IDataSource* datasource = m_report->dataManager()->dataSource(dataSourceName);
+ if (datasource){
+ fillFields(item,datasource);
+ if (!datasource->isInvalid())
+ item->setIcon(0,QIcon(":/databrowser/images/table_good"));
+ else
+ item->setIcon(0,QIcon(":/databrowser/images/table_error"));
+
+ } else item->setIcon(0,QIcon(":/databrowser/images/table_error"));
+
+ } catch(ReportError& exception) {
+ item->setIcon(0,QIcon(":/databrowser/images/table_error"));
+ //qDebug()<setSelected(true);
+ ui->dataTree->setCurrentItem(selectedItem);
+ }
+}
+
+void DataBrowser::updateVariablesTree()
+{
+ ui->variablesTree->clear();
+ QTreeWidgetItem *userVariables =new QTreeWidgetItem(QStringList(tr("User variables")),DataBrowserTree::Category);
+ userVariables->setIcon(0,QIcon(":/report/images/folder"));
+ QTreeWidgetItem *systemVariables =new QTreeWidgetItem(QStringList(tr("System variables")),DataBrowserTree::Category);
+ systemVariables->setIcon(0,QIcon(":/report/images/folder"));
+ ui->variablesTree->addTopLevelItem(userVariables);
+ ui->variablesTree->addTopLevelItem(systemVariables);
+
+ foreach(QString variableName,m_report->dataManager()->variableNames()){
+ QStringList values;
+ values<dataManager()->variableIsSystem(variableName))?
+ "":
+ " ["+m_report->dataManager()->variable(variableName).toString()+"]"
+ )
+ <setIcon(0,QIcon(":/databrowser/images/value"));
+ if (m_report->dataManager()->variableIsSystem(variableName)){
+ systemVariables->addChild(item);
+ } else {
+ userVariables->addChild(item);
+ }
+ }
+
+ ui->variablesTree->expandItem(userVariables);
+ ui->variablesTree->expandItem(systemVariables);
+}
+
+void DataBrowser::closeAllDataWindows()
+{
+ m_closingWindows = true;
+ QMap::iterator it = m_dataWindows.begin();
+ for(;it!=m_dataWindows.end();){
+ (*it)->close();
+ delete (*it);
+ it = m_dataWindows.erase(it);
+ }
+ m_closingWindows = false;
+}
+
+void DataBrowser::setSettings(QSettings *value, bool owned)
+{
+ if (m_settings && m_ownedSettings) delete m_settings;
+ m_settings=value;
+ m_ownedSettings = owned;
+}
+
+QSettings *DataBrowser::settings()
+{
+ if (m_settings){
+ return m_settings;
+ } else {
+ m_settings = new QSettings("LimeReport",QApplication::applicationName());
+ m_ownedSettings = true;
+ return m_settings;
+ }
+}
+
+void DataBrowser::slotDatasourcesChanged()
+{
+ updateDataTree();
+}
+
+void DataBrowser::fillFields(QTreeWidgetItem *parentItem, LimeReport::IDataSource *dataSource)
+{
+ if (!dataSource) return;
+ for (int i=0;icolumnCount();i++){
+ QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(dataSource->columnNameByIndex(i)),DataBrowserTree::Row);
+ item->setIcon(0,QIcon(":/databrowser/images/field"));
+ parentItem->addChild(item);
+ }
+ parentItem->sortChildren(0,Qt::AscendingOrder);
+}
+
+QTreeWidgetItem * DataBrowser::findByNameAndType(QString name, int itemType)
+{
+ if (name.isEmpty()) return 0;
+ QListitems = ui->dataTree->findItems(name,Qt::MatchContains | Qt::MatchRecursive);
+ if (!items.isEmpty()){
+ for (int i=0;itype()==itemType)/* && (items.at(0)->text(0)==name)*/){ return items.at(i);}
+ }
+ }
+ return 0;
+}
+
+void DataBrowser::slotViewDatasource()
+{
+ QString datasourceName=getDatasourceName();
+ if (!datasourceName.isEmpty()){
+ showDataWindow(datasourceName);
+ }
+}
+
+QString DataBrowser::getDatasourceName()
+{
+ if (ui->dataTree->currentItem()){
+ if (ui->dataTree->currentItem()->type() == DataBrowserTree::Table) return ui->dataTree->currentItem()->text(0);
+ if (ui->dataTree->currentItem()->type() == DataBrowserTree::Row) return ui->dataTree->currentItem()->parent()->text(0);
+ };
+ return QString();
+}
+
+QTreeWidgetItem* findConnectionItem(QTreeWidgetItem* item){
+ if (item->type() == DataBrowserTree::Connection){
+ return item;
+ } else {
+ if (item->parent())
+ return findConnectionItem(item->parent());
+ else
+ return 0;
+ }
+}
+
+QString DataBrowser::getConnectionName()
+{
+ if (ui->dataTree->currentItem()){
+ QTreeWidgetItem * ci = findConnectionItem(ui->dataTree->currentItem());
+ if (ci) return ci->text(0);
+ else return QString();
+ };
+ return QString();
+}
+
+QString DataBrowser::getVariable()
+{
+ if(ui->variablesTree->currentItem()&&ui->variablesTree->currentItem()->type() == DataBrowserTree::Variable){
+ return ui->variablesTree->currentItem()->text(1);
+ }
+ return QString();
+}
+
+void DataBrowser::slotEditDatasource()
+{
+ if (!getDatasourceName().isEmpty()){
+ closeDataWindow(getDatasourceName());
+ SQLEditDialog *sqlEdit = new SQLEditDialog(this,m_report->dataManager(),SQLEditDialog::EditMode);
+ sqlEdit->setAttribute(Qt::WA_DeleteOnClose);
+#if defined(WIN32) || defined(WIN64)
+ sqlEdit->setWindowModality(Qt::ApplicationModal);
+#else
+ sqlEdit->setWindowModality(Qt::WindowModal);
+#endif
+ sqlEdit->setSettings(settings());
+ sqlEdit->setDataSources(m_report->dataManager(),getDatasourceName());
+ connect(sqlEdit,SIGNAL(signalSqlEditingFinished(SQLEditResult)),this,SLOT(slotSQLEditingFinished(SQLEditResult)));
+ sqlEdit->exec();
+ }
+}
+
+void DataBrowser::slotDeleteDatasource()
+{
+ QString datasourceName=getDatasourceName();
+ QTreeWidgetItem *item = findByNameAndType(datasourceName, DataBrowserTree::Table);
+ if (item){
+ if (
+ QMessageBox::critical(
+ this,
+ tr("Attention"),
+ tr("Do you really want delete \"%1\" datasource ?").arg(datasourceName),
+ QMessageBox::Ok|QMessageBox::No,
+ QMessageBox::No
+ )==QMessageBox::Ok
+ ){
+ removeDatasource(datasourceName);
+ }
+ }
+}
+
+void DataBrowser::setReportEditor(LimeReport::ReportDesignWidget *report)
+{
+ m_report=report;
+ connect(m_report,SIGNAL(cleared()),this,SLOT(slotClear()));
+ connect(m_report->dataManager(), SIGNAL(datasourcesChanged()), this, SLOT(slotDatasourcesChanged()));
+ updateDataTree();
+ updateVariablesTree();
+}
+
+void DataBrowser::slotClear()
+{
+ ui->dataTree->clear();
+ foreach(QDockWidget* window,m_dataWindows.values()) window->close();
+ updateDataTree();
+}
+
+void DataBrowser::initConnections()
+{
+ ui->dataTree->clear();
+ QListitems;
+ foreach(QString connectionName,m_report->dataManager()->connectionNames()){
+ QTreeWidgetItem *item=new QTreeWidgetItem(ui->dataTree,QStringList(connectionName), DataBrowserTree::Connection);
+ if (m_report->dataManager()->isConnectionConnected(connectionName))
+ item->setIcon(0,QIcon(":/databrowser/images/database_connected"));
+ else
+ item->setIcon(0,QIcon(":/databrowser/images/database_disconnected"));
+ items.append(item);
+ }
+ ui->dataTree->insertTopLevelItems(0,items);
+}
+
+QDockWidget *DataBrowser::createDataWindow(QString datasourceName)
+{
+ QDockWidget *window = new QDockWidget("Table: "+datasourceName);
+ QTableView *tableView = new QTableView(window);
+ //TODO: exception or message ?
+
+ try {
+ IDataSource* datasource = m_report->dataManager()->dataSource(datasourceName);
+ if (datasource){
+ tableView->setModel(datasource->model());
+ }
+ } catch (ReportError& exception) {
+ qDebug()<setWidget(tableView);
+ window->setAttribute(Qt::WA_DeleteOnClose);
+ connect(window,SIGNAL(destroyed()),this,SLOT(slotDataWindowClosed()));
+
+ if (!m_dataWindows.isEmpty())
+ m_mainWindow->tabifyDockWidget(m_dataWindows.values().at(0),window);
+ else
+ m_mainWindow->addDockWidget(Qt::BottomDockWidgetArea,window);
+
+ m_dataWindows.insert(datasourceName,window);
+
+ return window;
+}
+
+QDockWidget *DataBrowser::dataWindow(QString datasourceName)
+{
+ if (m_dataWindows.contains(datasourceName)){
+ return m_dataWindows.value(datasourceName);
+ } else return createDataWindow(datasourceName);
+}
+
+void DataBrowser::setMainWindow(QMainWindow *mainWindow)
+{
+ m_mainWindow=mainWindow;
+}
+
+void DataBrowser::slotDataWindowClosed()
+{
+ if (isClosingWindows()) return;
+ for (int i=0;idataManager()->connectionByName(getConnectionName()),
+ this
+ );
+ connectionEdit->setAttribute(Qt::WA_DeleteOnClose,true);
+#if defined(WIN32) || defined(WIN64)
+ connectionEdit->setWindowModality(Qt::ApplicationModal);
+#else
+ connectionEdit->setWindowModality(Qt::WindowModal);
+#endif
+ //connect(connectionEdit,SIGNAL(finished(int)),this,SLOT(slotConnectionEditFinished(int)));
+ connectionEdit->exec();
+ }
+}
+
+void DataBrowser::slotChangeConnectionState()
+{
+ QString connectionName = getConnectionName();
+ if (!connectionName.isEmpty()){
+ if (!m_report->dataManager()->isConnectionConnected(connectionName)){
+ setCursor(Qt::WaitCursor);
+ //try {
+ if (!m_report->dataManager()->connectConnection(connectionName)){
+ //} catch(std::runtime_error &exception) {
+ QMessageBox::critical(this,tr("Attention"),m_report->dataManager()->lastError());
+ //}
+ }
+ updateDataTree();
+ setCursor(Qt::ArrowCursor);
+ } else {
+ m_report->dataManager()->disconnectConnection(connectionName);
+ updateDataTree();
+ }
+ }
+}
+
+void DataBrowser::slotVariableEditorAccept(const QString &variable)
+{
+ updateVariablesTree();
+ QList items = ui->variablesTree->findItems(variable, Qt::MatchContains | Qt::MatchRecursive);
+ if (!items.isEmpty()){
+ ui->variablesTree->setCurrentItem(items.at(0));
+ }
+}
+
+void DataBrowser::showDataWindow(QString datasourceName)
+{
+ QDockWidget *window = dataWindow(datasourceName);
+ if (window){
+ window->show();
+ window->raise();
+ }
+}
+
+void DataBrowser::closeDataWindow(QString datasourceName)
+{
+ if (m_dataWindows.contains(datasourceName))
+ m_dataWindows.value(datasourceName)->close();
+}
+
+void DataBrowser::removeDatasource(QString datasourceName)
+{
+ closeDataWindow(datasourceName);
+ m_report->dataManager()->removeDatasource(datasourceName);
+}
+
+void DataBrowser::addQuery(SQLEditResult result)
+{
+ try {
+ m_report->dataManager()->addQuery(result.datasourceName, result.sql, result.connectionName);
+ } catch(ReportError &exception){
+ qDebug()<dataManager()->removeDatasource(result.oldDatasourceName);
+ m_report->dataManager()->addQuery(result.datasourceName, result.sql, result.connectionName);
+ }catch(ReportError &exception){
+ qDebug()<dataManager()->addSubQuery(result.datasourceName, result.sql, result.connectionName, result.masterDatasource);
+ } catch(ReportError &exception){
+ qDebug()<dataManager()->removeDatasource(result.oldDatasourceName);
+ m_report->dataManager()->addSubQuery(result.datasourceName, result.sql, result.connectionName, result.masterDatasource);
+ }catch(ReportError &exception){
+ qDebug()<dataManager()->addProxy(result.datasourceName,result.masterDatasource,result.childDataSource,result.fieldMap);
+ } catch(ReportError &exception){
+ qDebug()<dataManager()->removeDatasource(result.oldDatasourceName);
+ m_report->dataManager()->addProxy(result.datasourceName,result.masterDatasource,result.childDataSource,result.fieldMap);
+ } catch(ReportError &exception){
+ qDebug()<dataManager()->addConnectionDesc(connection);
+ updateDataTree();
+}
+
+void DataBrowser::changeConnectionDesc(ConnectionDesc *connection)
+{
+ Q_UNUSED(connection)
+ updateDataTree();
+}
+
+void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
+{
+ Q_UNUSED(previous)
+ if (current&&(current->type() == DataBrowserTree::Connection)) {
+ ui->pbConnect->setEnabled(true);
+ if (m_report->dataManager()->isConnectionConnected(current->text(0))){
+ ui->pbConnect->setIcon(QIcon(":/databrowser/images/plug-connect.png"));
+ } else {
+ ui->pbConnect->setIcon(QIcon(":/databrowser/images/plug-disconnect.png"));
+ }
+ ui->editDataSource->setEnabled(false);
+ ui->deleteDataSource->setEnabled(false);
+ ui->viewDataSource->setEnabled(false);
+ ui->changeConnection->setEnabled(true);
+ ui->deleteConection->setEnabled(true);
+ ui->errorMessage->setDisabled(true);
+ } else {
+ ui->changeConnection->setEnabled(false);
+ ui->deleteConection->setEnabled(false);
+ ui->pbConnect->setEnabled(false);
+ IDataSourceHolder* holder = m_report->dataManager()->dataSourceHolder(getDatasourceName());
+ if (holder){
+ ui->viewDataSource->setEnabled(!holder->isInvalid());
+ ui->editDataSource->setEnabled(holder->isEditable());
+ ui->deleteDataSource->setEnabled(holder->isRemovable());
+ if (!holder->lastError().isEmpty()){
+ ui->errorMessage->setEnabled(true);
+ } else {ui->errorMessage->setEnabled(false);}
+ }
+ }
+}
+
+void LimeReport::DataBrowser::on_addVariable_clicked()
+{
+ LRVariableDialog dialog(this);
+#if defined(WIN32) || defined(WIN64)
+ dialog.setWindowModality(Qt::ApplicationModal);
+#else
+ dialog.setWindowModality(Qt::WindowModal);
+#endif
+ dialog.setVariableContainer(m_report->dataManager());
+ connect(&dialog,SIGNAL(signalVariableAccepted(QString)),this,SLOT(slotVariableEditorAccept(QString)));
+ dialog.exec();
+
+}
+
+void DataBrowser::on_editVariable_clicked()
+{
+ if (!getVariable().isEmpty())
+ {
+ LRVariableDialog dialog(this);
+#if defined(WIN32) || defined(WIN64)
+ dialog.setWindowModality(Qt::ApplicationModal);
+#else
+ dialog.setWindowModality(Qt::WindowModal);
+#endif
+ dialog.setVariableContainer(m_report->dataManager());
+ QString varName = getVariable();
+ dialog.setVariableName(varName);
+ connect(&dialog,SIGNAL(signalVariableAccepted(QString)),this,SLOT(slotVariableEditorAccept(QString)));
+ dialog.exec();
+ }
+}
+
+void DataBrowser::on_deleteVariable_clicked()
+{
+ QString varName = getVariable();
+ if (!varName.isEmpty()){
+ if (QMessageBox::critical(this,tr("Attention"),QString(tr("Do you really want delete variable \"%1\" ?")).arg(varName),
+ QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Cancel
+ )==QMessageBox::Ok){
+ m_report->dataManager()->deleteVariable(varName);
+ updateVariablesTree();
+ }
+ }
+}
+
+void DataBrowser::on_variablesTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
+{
+ Q_UNUSED(previous)
+
+ if (current){
+ if (m_report->dataManager()->containsVariable(current->text(1))&&
+ !m_report->dataManager()->variableIsSystem(current->text(1))
+ ){
+ ui->editVariable->setEnabled(true);
+ ui->deleteVariable->setEnabled(true);
+ } else {
+ ui->editVariable->setEnabled(false);
+ ui->deleteVariable->setEnabled(false);
+ }
+ }
+}
+
+void DataBrowser::on_errorMessage_clicked()
+{
+ if(!getDatasourceName().isEmpty()&&m_report->dataManager()->dataSourceHolder(getDatasourceName())){
+ QMessageBox::critical(this,tr("Error"),m_report->dataManager()->dataSourceHolder(getDatasourceName())->lastError());
+ }
+}
+
+} // namespace LimeReport
+
+
+
+
diff --git a/src/databrowser/lrdatabrowser.h b/src/databrowser/lrdatabrowser.h
new file mode 100644
index 0000000..06b10d3
--- /dev/null
+++ b/src/databrowser/lrdatabrowser.h
@@ -0,0 +1,115 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRDATABROWSER_H
+#define LRDATABROWSER_H
+
+#include
+#include
+#include
+#include
+
+#include "lrreportdesignwidget.h"
+#include "lrsqleditdialog.h"
+
+namespace Ui {
+ class DataBrowser;
+}
+namespace LimeReport{
+
+class DataBrowser : public QWidget, public IConnectionController
+{
+ Q_OBJECT
+public:
+
+ explicit DataBrowser(QWidget *parent = 0);
+ ~DataBrowser();
+ QSize sizeHint() const;
+ void setReportEditor(LimeReport::ReportDesignWidget* report);
+ void setMainWindow(QMainWindow* mainWindow);
+ void initConnections();
+ void updateDataTree();
+ void updateVariablesTree();
+ void closeAllDataWindows();
+ void setSettings(QSettings* value, bool owned = false);
+ QSettings* settings();
+private slots:
+ void slotDatasourcesChanged();
+ void slotAddConnection();
+ void slotDeleteConnection();
+ void slotAddDataSource();
+ void slotViewDatasource();
+ void slotEditDatasource();
+ void slotDeleteDatasource();
+ void slotSQLEditingFinished(SQLEditResult result);
+ void slotClear();
+ void slotDataWindowClosed();
+ void slotChangeConnection();
+ void slotChangeConnectionState();
+ void slotVariableEditorAccept(const QString &variable);
+ void on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
+ void on_editVariable_clicked();
+ void on_deleteVariable_clicked();
+ void on_addVariable_clicked();
+ void on_variablesTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
+ void on_errorMessage_clicked();
+private:
+ QString getDatasourceName();
+ QString getConnectionName();
+ QString getVariable();
+ bool isClosingWindows() const {return m_closingWindows;}
+ QTreeWidgetItem * findByNameAndType(QString name, int itemType);
+ void fillFields(QTreeWidgetItem *parentItem, LimeReport::IDataSource *dataSource);
+ QDockWidget* createDataWindow(QString datasourceName);
+ void closeDataWindow(QString datasourceName);
+ QDockWidget* dataWindow(QString datasourceName);
+ void showDataWindow(QString datasourceName);
+ void removeDatasource(QString datasourceName);
+ void addQuery(SQLEditResult result);
+ void changeQuery(SQLEditResult result);
+ void addSubQuery(SQLEditResult result);
+ void changeSubQuery(SQLEditResult result);
+ void addProxy(SQLEditResult result);
+ void changeProxy(SQLEditResult result);
+
+ void addConnectionDesc(ConnectionDesc *connection);
+ void changeConnectionDesc(ConnectionDesc *connection);
+
+private:
+ Ui::DataBrowser* ui;
+ ReportDesignWidget* m_report;
+ QMap m_dataWindows;
+ QMainWindow* m_mainWindow;
+ bool m_closingWindows;
+ QSettings* m_settings;
+ bool m_ownedSettings;
+};
+
+}
+#endif // LRDATABROWSER_H
diff --git a/src/databrowser/lrdatabrowser.qrc b/src/databrowser/lrdatabrowser.qrc
new file mode 100644
index 0000000..7a46b64
--- /dev/null
+++ b/src/databrowser/lrdatabrowser.qrc
@@ -0,0 +1,47 @@
+
+
+ images/data_add.png
+ images/data_delete.png
+ images/table.png
+ images/table_delete.png
+ images/data.png
+ images/row.png
+ images/edit_table.png
+ images/table_view.png
+ images/value_add.png
+ images/value_delete.png
+ images/value_edit.png
+ images/value.png
+ images/data_edit.png
+ images/add.png
+ images/remove.png
+ images/plug-connect.png
+ images/plug-disconnect.png
+ images/database_connect.png
+ images/database_disconnect.png
+ images/database_connected.png
+ images/database_connected2.png
+ images/table_error.png
+ images/table_good.png
+ images/error_message.png
+ images/error_message_2.png
+ images/data1.png
+ images/database_connected3.png
+ images/field.png
+ images/table_error1.png
+ images/table_good1.png
+ images/data_add1.png
+ images/data_delete1.png
+ images/data_edit1.png
+ images/table_add.png
+ images/table_delete1.png
+ images/table_edit.png
+ images/table_view1.png
+ images/value_add1.png
+ images/value_delete1.png
+ images/value_edit1.png
+ images/value_add2.png
+ images/value_edit2.png
+ images/value1.png
+
+
diff --git a/src/databrowser/lrdatabrowser.ui b/src/databrowser/lrdatabrowser.ui
new file mode 100644
index 0000000..f5c4a05
--- /dev/null
+++ b/src/databrowser/lrdatabrowser.ui
@@ -0,0 +1,484 @@
+
+
+ DataBrowser
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Datasources
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 2
+
+
+
+
+ QTabWidget::South
+
+
+ 0
+
+
+
+ Datasources
+
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+
+
+ 2
+
+
+
+
+ Add database connection
+
+
+ ...
+
+
+
+ :/databrowser/images/database_add:/databrowser/images/database_add
+
+
+
+ 16
+ 16
+
+
+
+ true
+
+
+
+
+
+
+ false
+
+
+ ...
+
+
+
+ :/databrowser/images/database_edit:/databrowser/images/database_edit
+
+
+
+ 16
+ 16
+
+
+
+ true
+
+
+
+
+
+
+ false
+
+
+ ...
+
+
+
+ :/databrowser/images/database_delete:/databrowser/images/database_delete
+
+
+
+ 16
+ 16
+
+
+
+ true
+
+
+
+
+
+
+ false
+
+
+ ...
+
+
+
+ :/databrowser/images/plug-connect.png:/databrowser/images/plug-connect.png
+
+
+
+ 16
+ 16
+
+
+
+ true
+
+
+
+
+
+
+ QFrame::VLine
+
+
+ QFrame::Sunken
+
+
+
+
+
+
+
+
+
+ ...
+
+
+
+ :/databrowser/images/table_add:/databrowser/images/table_add
+
+
+
+ 16
+ 16
+
+
+
+ true
+
+
+
+
+
+
+ false
+
+
+ ...
+
+
+
+ :/databrowser/images/table_view:/databrowser/images/table_view
+
+
+
+ 16
+ 16
+
+
+
+ true
+
+
+
+
+
+
+ false
+
+
+ ...
+
+
+
+ :/databrowser/images/table_edit:/databrowser/images/table_edit
+
+
+
+ 16
+ 16
+
+
+
+ true
+
+
+
+
+
+
+ false
+
+
+ ...
+
+
+
+ :/databrowser/images/table_delete:/databrowser/images/table_delete
+
+
+
+ 16
+ 16
+
+
+
+ true
+
+
+
+
+
+
+ false
+
+
+ ...
+
+
+
+ :/databrowser/images/error_message_2.png:/databrowser/images/error_message_2.png
+
+
+
+ 16
+ 16
+
+
+
+ true
+
+
+
+
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+ true
+
+
+ true
+
+
+ QAbstractItemView::DragOnly
+
+
+ false
+
+
+
+ 1
+
+
+
+
+
+
+
+
+ Variables
+
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+
+
+ 2
+
+
+
+
+ ...
+
+
+
+ :/databrowser/images/value_add:/databrowser/images/value_add
+
+
+
+ 16
+ 16
+
+
+
+ QToolButton::DelayedPopup
+
+
+ true
+
+
+
+
+
+
+ false
+
+
+ ...
+
+
+
+ :/databrowser/images/value_edit:/databrowser/images/value_edit
+
+
+
+ 16
+ 16
+
+
+
+ true
+
+
+
+
+
+
+ false
+
+
+ ...
+
+
+
+ :/databrowser/images/value_delete:/databrowser/images/value_delete
+
+
+
+ 16
+ 16
+
+
+
+ true
+
+
+
+
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+ true
+
+
+ QAbstractItemView::DragOnly
+
+
+ true
+
+
+ 1
+
+
+ false
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+ DataBrowserTree
+ QTreeWidget
+ lrdatabrowsertree.h
+
+
+
+ dataTree
+ addConnection
+ changeConnection
+ deleteConection
+ pbConnect
+ addDataSource
+ viewDataSource
+ editDataSource
+ deleteDataSource
+ variablesTree
+ addVariable
+ editVariable
+ deleteVariable
+ tabWidget
+
+
+
+
+
+
+ slotAddDataSource()
+ slotDeleteDataSource()
+
+
diff --git a/src/databrowser/lrdatabrowsertree.cpp b/src/databrowser/lrdatabrowsertree.cpp
new file mode 100644
index 0000000..b1fb944
--- /dev/null
+++ b/src/databrowser/lrdatabrowsertree.cpp
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrdatabrowsertree.h"
+#include
+#include
+
+DataBrowserTree::DataBrowserTree(QWidget *parent) :
+ QTreeWidget(parent){}
+
+QMimeData *DataBrowserTree::mimeData(const QList items) const
+{
+ QMimeData* result = QTreeWidget::mimeData(items);
+ if (items.at(0)->type()==Row){
+ result->setText("$D{"+items.at(0)->parent()->text(0)+"."+items.at(0)->data(0,Qt::DisplayRole).toString()+"}");
+ }
+ if (items.at(0)->type()==Variable){
+ result->setText("$V{"+items.at(0)->text(0)+"}");
+ }
+ return result;
+}
diff --git a/src/databrowser/lrdatabrowsertree.h b/src/databrowser/lrdatabrowsertree.h
new file mode 100644
index 0000000..1a44eb5
--- /dev/null
+++ b/src/databrowser/lrdatabrowsertree.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRDATABROWSERTREE_H
+#define LRDATABROWSERTREE_H
+
+#include
+
+class DataBrowserTree : public QTreeWidget
+{
+ Q_OBJECT
+public:
+ enum NodeType{Connection,Table,Row,Category,Variable};
+ explicit DataBrowserTree(QWidget *parent = 0);
+protected:
+ QMimeData* mimeData(const QList items) const;
+
+public slots:
+
+};
+
+#endif // LRDATABROWSERTREE_H
diff --git a/src/databrowser/lrsqleditdialog.cpp b/src/databrowser/lrsqleditdialog.cpp
new file mode 100644
index 0000000..ca20a32
--- /dev/null
+++ b/src/databrowser/lrsqleditdialog.cpp
@@ -0,0 +1,343 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrsqleditdialog.h"
+#include "ui_lrsqleditdialog.h"
+#include "lrreportengine_p.h"
+
+#include
+#include
+#include
+
+SQLEditDialog::SQLEditDialog(QWidget *parent, LimeReport::DataSourceManager *dataSources, SQLDialogMode dialogMode) :
+ QDialog(parent),
+ ui(new Ui::SQLEditDialog),m_datasources(dataSources),m_dialogMode(dialogMode), m_oldDatasourceName(""),
+ m_settings(0), m_ownedSettings(false)
+{
+ ui->setupUi(this);
+ m_masterDatasources = new QCompleter(this);
+ ui->leMaster->setCompleter(m_masterDatasources);
+ ui->leChild->setCompleter(m_masterDatasources);
+ ui->gbFieldsMap->setVisible(false);
+ ui->gbDataPreview->setVisible(false);
+ ui->pbHidePreview->setVisible(false);
+ ui->rbSubQuery->setChecked(true);
+ ui->rbProxy->setVisible(false);
+ ui->rbSubQuery->setVisible(false);
+ ui->leMaster->setVisible(false);
+ ui->lbMaster->setVisible(false);
+ ui->fieldsMap->setHorizontalHeaderItem(0,new QTableWidgetItem("master"));
+ ui->fieldsMap->setHorizontalHeaderItem(1,new QTableWidgetItem("detail"));
+
+#ifdef HAVE_QT5
+ ui->fieldsMap->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
+#else
+ ui->fieldsMap->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
+#endif
+ ui->pnlChildDatasource->setVisible(false);
+ connect(ui->pbPreview, SIGNAL(pressed()), this, SLOT(slotPreviewData()));
+ connect(ui->pbHidePreview, SIGNAL(pressed()), this, SLOT(slotHidePreview()));
+}
+
+SQLEditDialog::~SQLEditDialog()
+{
+ delete ui;
+ if (m_settings && m_ownedSettings)
+ delete m_settings;
+}
+
+QSettings *SQLEditDialog::settings(){
+ if (m_settings){
+ return m_settings;
+ } else {
+ m_settings = new QSettings("LimeReport",QApplication::applicationName());
+ m_ownedSettings = true;
+ return m_settings;
+ }
+}
+
+void SQLEditDialog::setSettings(QSettings *value, bool owned){
+ if (m_settings && m_ownedSettings) delete m_settings;
+ m_settings=value;
+ m_ownedSettings = owned;
+}
+
+void SQLEditDialog::accept()
+{
+ SQLEditResult result;
+
+ if (!ui->cbSubdetail->isChecked()){
+ result.resultMode=SQLEditResult::Query;
+ } else {
+ if (ui->rbSubQuery->isChecked()) result.resultMode=SQLEditResult::SubQuery;
+ else result.resultMode=SQLEditResult::SubProxy;
+ }
+
+ result.connectionName=ui->cbbConnection->currentText();
+ result.datasourceName=ui->leDatasourceName->text();
+ result.sql=ui->textEditSQL->toPlainText();
+ result.dialogMode=m_dialogMode;
+ result.oldDatasourceName=m_oldDatasourceName;
+ result.subdetail = ui->cbSubdetail->isChecked();
+ result.masterDatasource=ui->leMaster->text();
+ result.childDataSource=ui->leChild->text();
+
+ if (ui->fieldsMap->rowCount()>0){
+ for(int i=0;ifieldsMap->rowCount();++i){
+ LimeReport::FieldsCorrelation fieldsCorrelation;
+ fieldsCorrelation.master=ui->fieldsMap->item(i,0)->data(Qt::DisplayRole).toString();
+ fieldsCorrelation.detail=ui->fieldsMap->item(i,1)->data(Qt::DisplayRole).toString();
+ result.fieldMap.append(fieldsCorrelation);
+ }
+ }
+
+ try {
+ check();
+ emit signalSqlEditingFinished(result);
+ QDialog::accept();
+ }catch(LimeReport::ReportError &exception){
+ QMessageBox::critical(this,tr("Error"),exception.what());
+ }
+}
+
+void SQLEditDialog::showEvent(QShowEvent *)
+{
+ ui->lblInfo->setVisible(false);
+ initConnections();
+ readSettings();
+}
+
+void SQLEditDialog::closeEvent(QCloseEvent *)
+{
+ writeSetting();
+}
+
+void SQLEditDialog::hideEvent(QHideEvent *)
+{
+ writeSetting();
+}
+
+void SQLEditDialog::check()
+{
+ if (ui->leDatasourceName->text().isEmpty()) throw LimeReport::ReportError(tr("Datasource Name is empty !"));
+ if (ui->textEditSQL->toPlainText().isEmpty() && (!ui->rbProxy) ) throw LimeReport::ReportError(tr("SQL is empty !"));
+ if (m_dialogMode==AddMode){
+ if (m_datasources->containsDatasource(ui->leDatasourceName->text())){
+ throw LimeReport::ReportError(QString(tr("Datasource with name: \"%1\" already exists !")).arg(ui->leDatasourceName->text()));
+ }
+ }
+}
+
+void SQLEditDialog::initConnections()
+{
+ foreach(QString connectionName, QSqlDatabase::connectionNames()){
+ ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-connect.png"),connectionName);
+ }
+ foreach(QString connectionName, m_datasources->connectionNames()){
+ if (ui->cbbConnection->findText(connectionName,Qt::MatchExactly )==-1)
+ ui->cbbConnection->addItem(QIcon(":/databrowser/images/plug-disconnect.png"),connectionName);
+ }
+ ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(m_defaultConnection));
+ if (!m_oldDatasourceName.isEmpty()){
+ ui->cbbConnection->setCurrentIndex(ui->cbbConnection->findText(m_datasources->connectionName(m_oldDatasourceName)));
+ }
+}
+
+void SQLEditDialog::setDataSources(LimeReport::DataSourceManager *dataSources, QString datasourceName)
+{
+ m_datasources=dataSources;
+ if (!datasourceName.isEmpty()){
+ ui->cbSubdetail->setEnabled(false);
+ initQueryMode();
+ m_oldDatasourceName=datasourceName;
+ ui->leDatasourceName->setText(datasourceName);
+ ui->textEditSQL->setText(dataSources->queryText(datasourceName));
+ if (dataSources->isSubQuery(datasourceName)){
+ initSubQueryMode();
+ ui->leMaster->setText(dataSources->subQueryByName(datasourceName)->master());
+ }
+ if (dataSources->isProxy(datasourceName)){
+ initProxyMode();
+ LimeReport::ProxyDesc* proxyDesc = dataSources->proxyByName(datasourceName);
+ ui->leChild->setText(proxyDesc->child());
+ ui->leMaster->setText(proxyDesc->master());
+ int curIndex=0;
+ foreach(LimeReport::FieldMapDesc* fields, *proxyDesc->fieldsMap()){
+ ui->fieldsMap->setRowCount(curIndex+1);
+ ui->fieldsMap->setItem(curIndex,0,new QTableWidgetItem(fields->master()));
+ ui->fieldsMap->setItem(curIndex,1,new QTableWidgetItem(fields->detail()));
+ curIndex++;
+ }
+ }
+ }
+}
+
+void SQLEditDialog::setDefaultConnection(QString defaultConnection)
+{
+ m_defaultConnection=defaultConnection;
+}
+
+void SQLEditDialog::slotDataSourceNameEditing()
+{
+ if (m_dialogMode==AddMode){
+ QPalette palette=ui->leDatasourceName->palette();
+ if (m_datasources->containsDatasource(ui->leDatasourceName->text())){
+ palette.setColor(QPalette::Text,Qt::red);
+ ui->leDatasourceName->setPalette(palette);
+ ui->lblInfo->setText(QString(tr("Datasource with name %1 already exist")).arg(ui->leDatasourceName->text()));
+ ui->lblInfo->setVisible(true);
+ } else {
+ palette.setColor(QPalette::Text,QApplication::palette().text().color());
+ ui->leDatasourceName->setPalette(palette);
+ ui->lblInfo->setVisible(false);
+ }
+ }
+}
+
+void SQLEditDialog::on_cbSubdetail_clicked(bool checked)
+{
+ if (checked){
+ m_masterDatasources->setModel(new QStringListModel(m_datasources->dataSourceNames(),m_datasources));
+ }
+ ui->leMaster->setEnabled(checked);
+ ui->rbProxy->setEnabled(checked);
+ ui->rbSubQuery->setEnabled(checked);
+ if ((checked)&&(ui->rbProxy->isChecked())) initProxyMode();
+ if ((checked)&&(ui->rbSubQuery->isChecked())) initSubQueryMode();
+ if (!checked) initQueryMode();
+}
+
+void SQLEditDialog::on_rbProxy_clicked(bool checked)
+{
+ if (checked) initProxyMode();
+}
+
+void SQLEditDialog::on_rbSubQuery_clicked(bool checked)
+{
+ if (checked) initSubQueryMode();
+}
+
+void SQLEditDialog::on_pbAddField_clicked()
+{
+ ui->fieldsMap->setRowCount(ui->fieldsMap->rowCount()+1);
+}
+
+void SQLEditDialog::initQueryMode()
+{
+ ui->gbSQL->setVisible(true);
+ ui->gbFieldsMap->setVisible(false);
+ ui->pnlChildDatasource->setVisible(false);
+ ui->rbSubQuery->setVisible(false);
+ ui->rbProxy->setVisible(false);
+ ui->cbSubdetail->setChecked(false);
+ ui->leMaster->setVisible(false);
+ ui->lbMaster->setVisible(false);
+}
+
+void SQLEditDialog::initSubQueryMode()
+{
+ ui->gbSQL->setVisible(true);
+ ui->gbFieldsMap->setVisible(false);
+ ui->pnlChildDatasource->setVisible(false);
+ ui->rbSubQuery->setChecked(true);
+ ui->cbSubdetail->setChecked(true);
+ ui->rbSubQuery->setVisible(true);
+ ui->rbProxy->setVisible(true);
+ ui->leMaster->setVisible(true);
+ ui->leMaster->setEnabled(true);
+ ui->lbMaster->setVisible(true);
+
+}
+
+void SQLEditDialog::initProxyMode()
+{
+ ui->gbSQL->setVisible(false);
+ ui->gbFieldsMap->setVisible(true);
+ ui->pnlChildDatasource->setVisible(true);
+ ui->rbProxy->setChecked(true);
+ ui->cbSubdetail->setChecked(true);
+ ui->rbSubQuery->setVisible(true);
+ ui->rbProxy->setVisible(true);
+ ui->leMaster->setVisible(true);
+ ui->leMaster->setEnabled(true);
+ ui->lbMaster->setVisible(true);
+ ui->cbSubdetail->setEnabled(false);
+}
+
+void SQLEditDialog::slotPreviewData()
+{
+ if (ui->cbbConnection->currentText().isEmpty()){
+ QMessageBox::critical(this,tr("Attention"),tr("Connection is not specified"));
+ return;
+ }
+ m_previewModel = m_datasources->previewSQL(ui->cbbConnection->currentText(),ui->textEditSQL->toPlainText());
+ if (m_previewModel){
+ ui->tvPreview->setModel(m_previewModel.data());
+ ui->gbDataPreview->setVisible(true);
+ ui->pbPreview->setText(tr("Refresh"));
+ ui->pbHidePreview->setVisible(true);
+ } else {
+ if (ui->gbDataPreview->isVisible())
+ hidePreview();
+ QMessageBox::critical(this,tr("Attention"),m_datasources->lastError());
+ }
+}
+
+void SQLEditDialog::slotHidePreview()
+{
+ hidePreview();
+}
+
+void SQLEditDialog::writeSetting()
+{
+ if (settings()!=0){
+ settings()->beginGroup("SQLEditor");
+ settings()->setValue("Geometry",saveGeometry());
+ settings()->endGroup();
+ }
+}
+
+void SQLEditDialog::readSettings()
+{
+ if (settings()==0) return;
+ settings()->beginGroup("SQLEditor");
+ QVariant v = settings()->value("Geometry");
+ if (v.isValid()){
+ restoreGeometry(v.toByteArray());
+ }
+ settings()->endGroup();
+}
+
+void SQLEditDialog::hidePreview()
+{
+ ui->gbDataPreview->setVisible(false);
+ ui->pbPreview->setText(tr("Preview"));
+ ui->pbHidePreview->setVisible(false);
+}
+
diff --git a/src/databrowser/lrsqleditdialog.h b/src/databrowser/lrsqleditdialog.h
new file mode 100644
index 0000000..8122824
--- /dev/null
+++ b/src/databrowser/lrsqleditdialog.h
@@ -0,0 +1,109 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRSQLEDITDIALOG_H
+#define LRSQLEDITDIALOG_H
+
+#include
+#include
+#include
+#include
+#include "lrreportengine_p.h"
+#include "lrdatasourcemanager.h"
+#include "lrdatadesignintf.h"
+
+namespace Ui {
+ class SQLEditDialog;
+}
+
+struct SQLEditResult;
+
+class SQLEditDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ enum SQLDialogMode {AddMode,EditMode};
+ explicit SQLEditDialog(QWidget *parent, LimeReport::DataSourceManager* dataSources,SQLDialogMode dialogMode);
+ void setDataSources(LimeReport::DataSourceManager *dataSources,QString datasourceName="");
+ void setDefaultConnection(QString defaultConnection);
+ ~SQLEditDialog();
+ QSettings* settings();
+ void setSettings(QSettings* value, bool owned = false);
+signals:
+ void signalSqlEditingFinished(SQLEditResult result);
+protected:
+ void showEvent(QShowEvent *);
+ void closeEvent(QCloseEvent*);
+ void hideEvent(QHideEvent*);
+ void check();
+ void initConnections();
+private slots:
+ void accept();
+ void slotDataSourceNameEditing();
+ void on_cbSubdetail_clicked(bool checked);
+ void on_rbProxy_clicked(bool checked);
+ void on_rbSubQuery_clicked(bool checked);
+ void on_pbAddField_clicked();
+ void initQueryMode();
+ void initSubQueryMode();
+ void initProxyMode();
+ void slotPreviewData();
+ void slotHidePreview();
+private:
+ void writeSetting();
+ void readSettings();
+ void hidePreview();
+private:
+ Ui::SQLEditDialog *ui;
+ LimeReport::DataSourceManager* m_datasources;
+ SQLDialogMode m_dialogMode;
+ QString m_oldDatasourceName;
+ QCompleter* m_masterDatasources;
+ QString m_defaultConnection;
+ QSettings* m_settings;
+ bool m_ownedSettings;
+ QSharedPointer m_previewModel;
+};
+
+struct SQLEditResult{
+ enum ResultMode{Query,SubQuery,SubProxy};
+ QString connectionName;
+ QString datasourceName;
+ QString oldDatasourceName;
+ QString sql;
+ bool subdetail;
+ ResultMode resultMode;
+ QString masterDatasource;
+ QString childDataSource;
+ SQLEditDialog::SQLDialogMode dialogMode;
+ QList fieldMap;
+};
+
+#endif // LRSQLEDITDIALOG_H
diff --git a/src/databrowser/lrsqleditdialog.ui b/src/databrowser/lrsqleditdialog.ui
new file mode 100644
index 0000000..9e9116c
--- /dev/null
+++ b/src/databrowser/lrsqleditdialog.ui
@@ -0,0 +1,859 @@
+
+
+ SQLEditDialog
+
+
+
+ 0
+ 0
+ 411
+ 617
+
+
+
+ Datasource
+
+
+
+ :/databrowser/images/database_disconnected:/databrowser/images/database_disconnected
+
+
+
+
+
+
+
+
+
+
+ Connection
+
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+ Qt::NoFocus
+
+
+
+
+
+
+
+
+
+
+
+
+ Datasource Name
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 127
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 191
+
+
+
+
+
+
+ 127
+ 127
+ 63
+
+
+
+
+
+
+ 170
+ 170
+ 84
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 127
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 191
+
+
+
+
+
+
+ 255
+ 255
+ 220
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 127
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 191
+
+
+
+
+
+
+ 127
+ 127
+ 63
+
+
+
+
+
+
+ 170
+ 170
+ 84
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 127
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 191
+
+
+
+
+
+
+ 255
+ 255
+ 220
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 127
+ 127
+ 63
+
+
+
+
+
+
+ 255
+ 255
+ 127
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 255
+ 255
+ 191
+
+
+
+
+
+
+ 127
+ 127
+ 63
+
+
+
+
+
+
+ 170
+ 170
+ 84
+
+
+
+
+
+
+ 127
+ 127
+ 63
+
+
+
+
+
+
+ 255
+ 255
+ 255
+
+
+
+
+
+
+ 127
+ 127
+ 63
+
+
+
+
+
+
+ 255
+ 255
+ 127
+
+
+
+
+
+
+ 255
+ 255
+ 127
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ 255
+ 255
+ 127
+
+
+
+
+
+
+ 255
+ 255
+ 220
+
+
+
+
+
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ -1
+
+
+
+
+
+
+
+
+
+
+ Subdetail
+
+
+
+
+
+
+
+
+ Master datasource
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+ false
+
+
+ Subquery mode
+
+
+
+
+
+
+ false
+
+
+ Filter mode
+
+
+
+
+
+
+
+
+ SQL
+
+
+
+ 4
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+
+
+
+
+
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+ Preview
+
+
+
+
+
+
+ Hide Preview
+
+
+
+
+
+
+
+
+
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Raised
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+
+
+ Child datasource
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Fields map
+
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+ ...
+
+
+
+ :/databrowser/images/add.png:/databrowser/images/add.png
+
+
+ true
+
+
+
+
+
+
+ ...
+
+
+
+ :/databrowser/images/remove.png:/databrowser/images/remove.png
+
+
+ true
+
+
+
+
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+
+
+
+ Data preview
+
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+ Cancel
+
+
+ false
+
+
+
+
+
+
+ Ok
+
+
+ false
+
+
+
+
+
+
+
+
+ leDatasourceName
+ cbSubdetail
+ leMaster
+ rbSubQuery
+ rbProxy
+ textEditSQL
+ leChild
+ fieldsMap
+ pbAddField
+ pbDelField
+ pushButton_2
+ pushButton
+
+
+
+
+
+
+ leDatasourceName
+ textChanged(QString)
+ SQLEditDialog
+ slotDataSourceNameEditing()
+
+
+ 259
+ 54
+
+
+ 289
+ 32
+
+
+
+
+ pushButton
+ clicked()
+ SQLEditDialog
+ accept()
+
+
+ 397
+ 536
+
+
+ 380
+ 360
+
+
+
+
+ pushButton_2
+ clicked()
+ SQLEditDialog
+ reject()
+
+
+ 278
+ 538
+
+
+ 299
+ 383
+
+
+
+
+
+ slotDataSourceNameEditing()
+
+
diff --git a/src/databrowser/lrvariabledialog.cpp b/src/databrowser/lrvariabledialog.cpp
new file mode 100644
index 0000000..a2d5dec
--- /dev/null
+++ b/src/databrowser/lrvariabledialog.cpp
@@ -0,0 +1,99 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrvariabledialog.h"
+#include "ui_lrvariabledialog.h"
+#include "lrglobal.h"
+#include
+#include
+
+LRVariableDialog::LRVariableDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::LRVariableDialog),
+ m_variableName(""),
+ m_variablesContainer(0),
+ m_changeMode(false),
+ m_oldVariableName("")
+{
+ ui->setupUi(this);
+ ui->cbbType->setVisible(false);
+ ui->lblType->setVisible(false);
+}
+
+LRVariableDialog::~LRVariableDialog()
+{
+ delete ui;
+}
+
+void LRVariableDialog::setVariableContainer(LimeReport::IVariablesContainer *value)
+{
+ m_variablesContainer=value;
+}
+
+void LRVariableDialog::setVariableName(const QString &value)
+{
+ m_variableName=value;
+ m_changeMode=true;
+ m_oldVariableName=value;
+}
+
+void LRVariableDialog::showEvent(QShowEvent *)
+{
+ ui->leName->setText(m_variableName);
+ if (!m_variableName.isEmpty()&&m_variablesContainer&&m_variablesContainer->containsVariable(m_variableName)){
+ ui->leValue->setText(m_variablesContainer->variable(m_variableName).toString());
+ }
+}
+
+void LRVariableDialog::accept()
+{
+ try{
+ if (m_variablesContainer&&!ui->leName->text().isEmpty()){
+ if (m_changeMode){
+ if (m_oldVariableName==ui->leName->text()){
+ m_variablesContainer->changeVariable(m_oldVariableName,value());
+ } else {
+ m_variablesContainer->deleteVariable(m_oldVariableName);
+ m_variablesContainer->addVariable(ui->leName->text(),value());
+ }
+ } else {
+ m_variablesContainer->addVariable(ui->leName->text(),value());
+ }
+ emit signalVariableAccepted(ui->leName->text());
+ QDialog::accept();
+ }
+ } catch (LimeReport::ReportError &exception){
+ QMessageBox::critical(this,tr("Attention"),exception.what());
+ }
+}
+
+QVariant LRVariableDialog::value()
+{
+ return ui->leValue->text();
+}
diff --git a/src/databrowser/lrvariabledialog.h b/src/databrowser/lrvariabledialog.h
new file mode 100644
index 0000000..49ba046
--- /dev/null
+++ b/src/databrowser/lrvariabledialog.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRVARIABLEDIALOG_H
+#define LRVARIABLEDIALOG_H
+
+#include
+#include "lrvariablesholder.h"
+
+namespace Ui {
+class LRVariableDialog;
+}
+
+class LRVariableDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit LRVariableDialog(QWidget *parent = 0);
+ ~LRVariableDialog();
+ void setVariableContainer(LimeReport::IVariablesContainer *value);
+ void setVariableName(const QString &value);
+protected:
+ void showEvent(QShowEvent *);
+private slots:
+ void accept();
+signals:
+ void signalVariableAccepted(const QString &variable);
+private:
+ QVariant value();
+private:
+ Ui::LRVariableDialog *ui;
+ QString m_variableName;
+ LimeReport::IVariablesContainer* m_variablesContainer;
+ bool m_changeMode;
+ QString m_oldVariableName;
+};
+
+#endif // LRVARIABLEDIALOG_H
diff --git a/src/databrowser/lrvariabledialog.ui b/src/databrowser/lrvariabledialog.ui
new file mode 100644
index 0000000..df97830
--- /dev/null
+++ b/src/databrowser/lrvariabledialog.ui
@@ -0,0 +1,131 @@
+
+
+ LRVariableDialog
+
+
+
+ 0
+ 0
+ 218
+ 126
+
+
+
+ Variable
+
+
+
+ :/databrowser/images/value:/databrowser/images/value
+
+
+
+ 2
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+ 4
+
+
+
+
+ 7
+
+
+ 5
+
+
+ 4
+
+
+ 8
+
+
+
+
+ Name
+
+
+
+
+
+
+
+
+
+ Value
+
+
+
+
+
+
+
+
+
+
+
+
+ Type
+
+
+
+
+
+
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ LRVariableDialog
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ LRVariableDialog
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/images/Control-Edit Box.png b/src/images/Control-Edit Box.png
new file mode 100644
index 0000000..ea0fb75
Binary files /dev/null and b/src/images/Control-Edit Box.png differ
diff --git a/src/images/Hourglass_80.png b/src/images/Hourglass_80.png
new file mode 100644
index 0000000..ce174d3
Binary files /dev/null and b/src/images/Hourglass_80.png differ
diff --git a/src/images/addBand.png b/src/images/addBand.png
new file mode 100644
index 0000000..d927ac9
Binary files /dev/null and b/src/images/addBand.png differ
diff --git a/src/images/addBand1.png b/src/images/addBand1.png
new file mode 100644
index 0000000..6496959
Binary files /dev/null and b/src/images/addBand1.png differ
diff --git a/src/images/allLines.png b/src/images/allLines.png
new file mode 100644
index 0000000..33925af
Binary files /dev/null and b/src/images/allLines.png differ
diff --git a/src/images/allLines1.png b/src/images/allLines1.png
new file mode 100644
index 0000000..f613d30
Binary files /dev/null and b/src/images/allLines1.png differ
diff --git a/src/images/barcode.png b/src/images/barcode.png
new file mode 100644
index 0000000..19669cd
Binary files /dev/null and b/src/images/barcode.png differ
diff --git a/src/images/barcode1.png b/src/images/barcode1.png
new file mode 100644
index 0000000..3360dd8
Binary files /dev/null and b/src/images/barcode1.png differ
diff --git a/src/images/barcode2.png b/src/images/barcode2.png
new file mode 100644
index 0000000..328a2ac
Binary files /dev/null and b/src/images/barcode2.png differ
diff --git a/src/images/barcode3_16.png b/src/images/barcode3_16.png
new file mode 100644
index 0000000..80d9397
Binary files /dev/null and b/src/images/barcode3_16.png differ
diff --git a/src/images/barcode3_24.png b/src/images/barcode3_24.png
new file mode 100644
index 0000000..10fd139
Binary files /dev/null and b/src/images/barcode3_24.png differ
diff --git a/src/images/bottomLine.png b/src/images/bottomLine.png
new file mode 100644
index 0000000..70cacbd
Binary files /dev/null and b/src/images/bottomLine.png differ
diff --git a/src/images/bottomLine1.png b/src/images/bottomLine1.png
new file mode 100644
index 0000000..6566228
Binary files /dev/null and b/src/images/bottomLine1.png differ
diff --git a/src/images/bringToFront.png b/src/images/bringToFront.png
new file mode 100644
index 0000000..b411bbf
Binary files /dev/null and b/src/images/bringToFront.png differ
diff --git a/src/images/closebox.png b/src/images/closebox.png
new file mode 100644
index 0000000..46d90bc
Binary files /dev/null and b/src/images/closebox.png differ
diff --git a/src/images/copy.png b/src/images/copy.png
new file mode 100644
index 0000000..c4a26b9
Binary files /dev/null and b/src/images/copy.png differ
diff --git a/src/images/copy16.png b/src/images/copy16.png
new file mode 100644
index 0000000..9c71808
Binary files /dev/null and b/src/images/copy16.png differ
diff --git a/src/images/copy2.png b/src/images/copy2.png
new file mode 100644
index 0000000..da050ea
Binary files /dev/null and b/src/images/copy2.png differ
diff --git a/src/images/copy24.png b/src/images/copy24.png
new file mode 100644
index 0000000..4c21085
Binary files /dev/null and b/src/images/copy24.png differ
diff --git a/src/images/copy_2_16.png b/src/images/copy_2_16.png
new file mode 100644
index 0000000..db1d9fb
Binary files /dev/null and b/src/images/copy_2_16.png differ
diff --git a/src/images/copy_2_24.png b/src/images/copy_2_24.png
new file mode 100644
index 0000000..9f556a0
Binary files /dev/null and b/src/images/copy_2_24.png differ
diff --git a/src/images/cpyright_logo.png b/src/images/cpyright_logo.png
new file mode 100644
index 0000000..d51095f
Binary files /dev/null and b/src/images/cpyright_logo.png differ
diff --git a/src/images/cut.png b/src/images/cut.png
new file mode 100644
index 0000000..730625b
Binary files /dev/null and b/src/images/cut.png differ
diff --git a/src/images/cut1.png b/src/images/cut1.png
new file mode 100644
index 0000000..8339751
Binary files /dev/null and b/src/images/cut1.png differ
diff --git a/src/images/cut16.png b/src/images/cut16.png
new file mode 100644
index 0000000..edd1844
Binary files /dev/null and b/src/images/cut16.png differ
diff --git a/src/images/cut24.png b/src/images/cut24.png
new file mode 100644
index 0000000..c87f288
Binary files /dev/null and b/src/images/cut24.png differ
diff --git a/src/images/cut_1_24.png b/src/images/cut_1_24.png
new file mode 100644
index 0000000..62af544
Binary files /dev/null and b/src/images/cut_1_24.png differ
diff --git a/src/images/cut_24.png b/src/images/cut_24.png
new file mode 100644
index 0000000..19a62ec
Binary files /dev/null and b/src/images/cut_24.png differ
diff --git a/src/images/dasabases.png b/src/images/dasabases.png
new file mode 100644
index 0000000..94a9cb1
Binary files /dev/null and b/src/images/dasabases.png differ
diff --git a/src/images/database.png b/src/images/database.png
new file mode 100644
index 0000000..af7dd7e
Binary files /dev/null and b/src/images/database.png differ
diff --git a/src/images/delete.png b/src/images/delete.png
new file mode 100644
index 0000000..a7ebb08
Binary files /dev/null and b/src/images/delete.png differ
diff --git a/src/images/delete1.png b/src/images/delete1.png
new file mode 100644
index 0000000..7c557a0
Binary files /dev/null and b/src/images/delete1.png differ
diff --git a/src/images/design.png b/src/images/design.png
new file mode 100644
index 0000000..c3fd61d
Binary files /dev/null and b/src/images/design.png differ
diff --git a/src/images/dialog-close.png b/src/images/dialog-close.png
new file mode 100644
index 0000000..8f2ae53
Binary files /dev/null and b/src/images/dialog-close.png differ
diff --git a/src/images/dialog-close_red.png b/src/images/dialog-close_red.png
new file mode 100644
index 0000000..5cfdad3
Binary files /dev/null and b/src/images/dialog-close_red.png differ
diff --git a/src/images/disk_blue.png b/src/images/disk_blue.png
new file mode 100644
index 0000000..1abc0e7
Binary files /dev/null and b/src/images/disk_blue.png differ
diff --git a/src/images/document-new_16.png b/src/images/document-new_16.png
new file mode 100644
index 0000000..d3661a1
Binary files /dev/null and b/src/images/document-new_16.png differ
diff --git a/src/images/document-new_24.png b/src/images/document-new_24.png
new file mode 100644
index 0000000..5df5bd4
Binary files /dev/null and b/src/images/document-new_24.png differ
diff --git a/src/images/document_add.png b/src/images/document_add.png
new file mode 100644
index 0000000..dc06d21
Binary files /dev/null and b/src/images/document_add.png differ
diff --git a/src/images/document_add_1.png b/src/images/document_add_1.png
new file mode 100644
index 0000000..562efc2
Binary files /dev/null and b/src/images/document_add_1.png differ
diff --git a/src/images/document_delete_16.png b/src/images/document_delete_16.png
new file mode 100644
index 0000000..f4fb311
Binary files /dev/null and b/src/images/document_delete_16.png differ
diff --git a/src/images/document_delete_24.png b/src/images/document_delete_24.png
new file mode 100644
index 0000000..8199e63
Binary files /dev/null and b/src/images/document_delete_24.png differ
diff --git a/src/images/document_zoom_in.png b/src/images/document_zoom_in.png
new file mode 100644
index 0000000..5d46e3e
Binary files /dev/null and b/src/images/document_zoom_in.png differ
diff --git a/src/images/document_zoom_in_1.png b/src/images/document_zoom_in_1.png
new file mode 100644
index 0000000..a73a4bf
Binary files /dev/null and b/src/images/document_zoom_in_1.png differ
diff --git a/src/images/document_zoom_out.png b/src/images/document_zoom_out.png
new file mode 100644
index 0000000..0cb534b
Binary files /dev/null and b/src/images/document_zoom_out.png differ
diff --git a/src/images/document_zoom_out_1.png b/src/images/document_zoom_out_1.png
new file mode 100644
index 0000000..d4efa86
Binary files /dev/null and b/src/images/document_zoom_out_1.png differ
diff --git a/src/images/edit-copy_1_16.png b/src/images/edit-copy_1_16.png
new file mode 100644
index 0000000..8dd48c4
Binary files /dev/null and b/src/images/edit-copy_1_16.png differ
diff --git a/src/images/edit-copy_1_24.png b/src/images/edit-copy_1_24.png
new file mode 100644
index 0000000..345b2f1
Binary files /dev/null and b/src/images/edit-copy_1_24.png differ
diff --git a/src/images/edit-paste_1_16.png b/src/images/edit-paste_1_16.png
new file mode 100644
index 0000000..b0fa070
Binary files /dev/null and b/src/images/edit-paste_1_16.png differ
diff --git a/src/images/edit-paste_1_24.png b/src/images/edit-paste_1_24.png
new file mode 100644
index 0000000..d131b84
Binary files /dev/null and b/src/images/edit-paste_1_24.png differ
diff --git a/src/images/edit-paste_2_24.png b/src/images/edit-paste_2_24.png
new file mode 100644
index 0000000..cc8b1bd
Binary files /dev/null and b/src/images/edit-paste_2_24.png differ
diff --git a/src/images/edit.png b/src/images/edit.png
new file mode 100644
index 0000000..083b97c
Binary files /dev/null and b/src/images/edit.png differ
diff --git a/src/images/edit_control_24.png b/src/images/edit_control_24.png
new file mode 100644
index 0000000..c2af048
Binary files /dev/null and b/src/images/edit_control_24.png differ
diff --git a/src/images/edit_control_2_24.png b/src/images/edit_control_2_24.png
new file mode 100644
index 0000000..18717d4
Binary files /dev/null and b/src/images/edit_control_2_24.png differ
diff --git a/src/images/edit_control_3_24.png b/src/images/edit_control_3_24.png
new file mode 100644
index 0000000..42ed53d
Binary files /dev/null and b/src/images/edit_control_3_24.png differ
diff --git a/src/images/edit_cursor.png b/src/images/edit_cursor.png
new file mode 100644
index 0000000..21070fb
Binary files /dev/null and b/src/images/edit_cursor.png differ
diff --git a/src/images/edit_layout.png b/src/images/edit_layout.png
new file mode 100644
index 0000000..1f12414
Binary files /dev/null and b/src/images/edit_layout.png differ
diff --git a/src/images/edit_layout_2_24.png b/src/images/edit_layout_2_24.png
new file mode 100644
index 0000000..23818d3
Binary files /dev/null and b/src/images/edit_layout_2_24.png differ
diff --git a/src/images/edit_layout_3_24.png b/src/images/edit_layout_3_24.png
new file mode 100644
index 0000000..b000f6f
Binary files /dev/null and b/src/images/edit_layout_3_24.png differ
diff --git a/src/images/edit_layout_4_24.png b/src/images/edit_layout_4_24.png
new file mode 100644
index 0000000..29e1387
Binary files /dev/null and b/src/images/edit_layout_4_24.png differ
diff --git a/src/images/edit_pecil2.png b/src/images/edit_pecil2.png
new file mode 100644
index 0000000..29fc9a0
Binary files /dev/null and b/src/images/edit_pecil2.png differ
diff --git a/src/images/edit_pencil.png b/src/images/edit_pencil.png
new file mode 100644
index 0000000..c2b75d9
Binary files /dev/null and b/src/images/edit_pencil.png differ
diff --git a/src/images/errors.png b/src/images/errors.png
new file mode 100644
index 0000000..d534c53
Binary files /dev/null and b/src/images/errors.png differ
diff --git a/src/images/field.png b/src/images/field.png
new file mode 100644
index 0000000..3cb6ea6
Binary files /dev/null and b/src/images/field.png differ
diff --git a/src/images/first2.png b/src/images/first2.png
new file mode 100644
index 0000000..082aecd
Binary files /dev/null and b/src/images/first2.png differ
diff --git a/src/images/folder.png b/src/images/folder.png
new file mode 100644
index 0000000..084c9da
Binary files /dev/null and b/src/images/folder.png differ
diff --git a/src/images/folder1.png b/src/images/folder1.png
new file mode 100644
index 0000000..528229c
Binary files /dev/null and b/src/images/folder1.png differ
diff --git a/src/images/folder3.png b/src/images/folder3.png
new file mode 100644
index 0000000..d857735
Binary files /dev/null and b/src/images/folder3.png differ
diff --git a/src/images/function.png b/src/images/function.png
new file mode 100644
index 0000000..65186bd
Binary files /dev/null and b/src/images/function.png differ
diff --git a/src/images/function2.png b/src/images/function2.png
new file mode 100644
index 0000000..f346cc2
Binary files /dev/null and b/src/images/function2.png differ
diff --git a/src/images/function3.png b/src/images/function3.png
new file mode 100644
index 0000000..d6371b9
Binary files /dev/null and b/src/images/function3.png differ
diff --git a/src/images/go-next.png b/src/images/go-next.png
new file mode 100644
index 0000000..da01acc
Binary files /dev/null and b/src/images/go-next.png differ
diff --git a/src/images/hlayout.png b/src/images/hlayout.png
new file mode 100644
index 0000000..3c9523e
Binary files /dev/null and b/src/images/hlayout.png differ
diff --git a/src/images/hlayuot_1_24.png b/src/images/hlayuot_1_24.png
new file mode 100644
index 0000000..12340fe
Binary files /dev/null and b/src/images/hlayuot_1_24.png differ
diff --git a/src/images/hlayuot_2_24.png b/src/images/hlayuot_2_24.png
new file mode 100644
index 0000000..c648cb2
Binary files /dev/null and b/src/images/hlayuot_2_24.png differ
diff --git a/src/images/hlayuot_3_24.png b/src/images/hlayuot_3_24.png
new file mode 100644
index 0000000..66cf271
Binary files /dev/null and b/src/images/hlayuot_3_24.png differ
diff --git a/src/images/hourglass.png b/src/images/hourglass.png
new file mode 100644
index 0000000..2cb94c7
Binary files /dev/null and b/src/images/hourglass.png differ
diff --git a/src/images/insert-text_16.png b/src/images/insert-text_16.png
new file mode 100644
index 0000000..0a1b7d0
Binary files /dev/null and b/src/images/insert-text_16.png differ
diff --git a/src/images/insert-text_1_24.png b/src/images/insert-text_1_24.png
new file mode 100644
index 0000000..e5c6841
Binary files /dev/null and b/src/images/insert-text_1_24.png differ
diff --git a/src/images/insert-text_24.png b/src/images/insert-text_24.png
new file mode 100644
index 0000000..de6c75f
Binary files /dev/null and b/src/images/insert-text_24.png differ
diff --git a/src/images/last2.png b/src/images/last2.png
new file mode 100644
index 0000000..dd0145a
Binary files /dev/null and b/src/images/last2.png differ
diff --git a/src/images/layuot_create.png b/src/images/layuot_create.png
new file mode 100644
index 0000000..095b604
Binary files /dev/null and b/src/images/layuot_create.png differ
diff --git a/src/images/layuot_create_24.png b/src/images/layuot_create_24.png
new file mode 100644
index 0000000..f8a162a
Binary files /dev/null and b/src/images/layuot_create_24.png differ
diff --git a/src/images/layuot_delete_24.png b/src/images/layuot_delete_24.png
new file mode 100644
index 0000000..a3ef37e
Binary files /dev/null and b/src/images/layuot_delete_24.png differ
diff --git a/src/images/layuot_move.png b/src/images/layuot_move.png
new file mode 100644
index 0000000..922fe74
Binary files /dev/null and b/src/images/layuot_move.png differ
diff --git a/src/images/layuot_select.png b/src/images/layuot_select.png
new file mode 100644
index 0000000..dabd5fc
Binary files /dev/null and b/src/images/layuot_select.png differ
diff --git a/src/images/layuot_select_24.png b/src/images/layuot_select_24.png
new file mode 100644
index 0000000..f3b4588
Binary files /dev/null and b/src/images/layuot_select_24.png differ
diff --git a/src/images/leftLine.png b/src/images/leftLine.png
new file mode 100644
index 0000000..e98990b
Binary files /dev/null and b/src/images/leftLine.png differ
diff --git a/src/images/leftLine1.png b/src/images/leftLine1.png
new file mode 100644
index 0000000..cb8c9d1
Binary files /dev/null and b/src/images/leftLine1.png differ
diff --git a/src/images/logo.png b/src/images/logo.png
new file mode 100644
index 0000000..a466bbb
Binary files /dev/null and b/src/images/logo.png differ
diff --git a/src/images/logo_100.png b/src/images/logo_100.png
new file mode 100644
index 0000000..d626e9f
Binary files /dev/null and b/src/images/logo_100.png differ
diff --git a/src/images/main.ico b/src/images/main.ico
new file mode 100644
index 0000000..7f11705
Binary files /dev/null and b/src/images/main.ico differ
diff --git a/src/images/main.png b/src/images/main.png
new file mode 100644
index 0000000..216f24a
Binary files /dev/null and b/src/images/main.png differ
diff --git a/src/images/move_back.png b/src/images/move_back.png
new file mode 100644
index 0000000..a913279
Binary files /dev/null and b/src/images/move_back.png differ
diff --git a/src/images/move_top_1.png b/src/images/move_top_1.png
new file mode 100644
index 0000000..aefcb79
Binary files /dev/null and b/src/images/move_top_1.png differ
diff --git a/src/images/new_1_16.png b/src/images/new_1_16.png
new file mode 100644
index 0000000..27e02bd
Binary files /dev/null and b/src/images/new_1_16.png differ
diff --git a/src/images/new_1_24.png b/src/images/new_1_24.png
new file mode 100644
index 0000000..efa2da7
Binary files /dev/null and b/src/images/new_1_24.png differ
diff --git a/src/images/new_leaf.png b/src/images/new_leaf.png
new file mode 100644
index 0000000..59c868a
Binary files /dev/null and b/src/images/new_leaf.png differ
diff --git a/src/images/new_leaf1.png b/src/images/new_leaf1.png
new file mode 100644
index 0000000..d89f8d3
Binary files /dev/null and b/src/images/new_leaf1.png differ
diff --git a/src/images/next.png b/src/images/next.png
new file mode 100644
index 0000000..f88c881
Binary files /dev/null and b/src/images/next.png differ
diff --git a/src/images/next1.png b/src/images/next1.png
new file mode 100644
index 0000000..9b3a487
Binary files /dev/null and b/src/images/next1.png differ
diff --git a/src/images/next2.png b/src/images/next2.png
new file mode 100644
index 0000000..4d2a52c
Binary files /dev/null and b/src/images/next2.png differ
diff --git a/src/images/noLines.png b/src/images/noLines.png
new file mode 100644
index 0000000..9d41db0
Binary files /dev/null and b/src/images/noLines.png differ
diff --git a/src/images/noLines1.png b/src/images/noLines1.png
new file mode 100644
index 0000000..264044e
Binary files /dev/null and b/src/images/noLines1.png differ
diff --git a/src/images/paste.png b/src/images/paste.png
new file mode 100644
index 0000000..3514130
Binary files /dev/null and b/src/images/paste.png differ
diff --git a/src/images/paste1.png b/src/images/paste1.png
new file mode 100644
index 0000000..ed5b4bc
Binary files /dev/null and b/src/images/paste1.png differ
diff --git a/src/images/paste16.png b/src/images/paste16.png
new file mode 100644
index 0000000..a4e0a02
Binary files /dev/null and b/src/images/paste16.png differ
diff --git a/src/images/paste24.png b/src/images/paste24.png
new file mode 100644
index 0000000..bd6fe40
Binary files /dev/null and b/src/images/paste24.png differ
diff --git a/src/images/paste_1_24.png b/src/images/paste_1_24.png
new file mode 100644
index 0000000..13450d0
Binary files /dev/null and b/src/images/paste_1_24.png differ
diff --git a/src/images/pin_green.png b/src/images/pin_green.png
new file mode 100644
index 0000000..355510e
Binary files /dev/null and b/src/images/pin_green.png differ
diff --git a/src/images/prin-preview2.png b/src/images/prin-preview2.png
new file mode 100644
index 0000000..bad9ab0
Binary files /dev/null and b/src/images/prin-preview2.png differ
diff --git a/src/images/prin-preview_2.png b/src/images/prin-preview_2.png
new file mode 100644
index 0000000..6c6c63e
Binary files /dev/null and b/src/images/prin-preview_2.png differ
diff --git a/src/images/prin-preview_3.png b/src/images/prin-preview_3.png
new file mode 100644
index 0000000..370f695
Binary files /dev/null and b/src/images/prin-preview_3.png differ
diff --git a/src/images/prin-preview_4_24.png b/src/images/prin-preview_4_24.png
new file mode 100644
index 0000000..ec9f55e
Binary files /dev/null and b/src/images/prin-preview_4_24.png differ
diff --git a/src/images/print.png b/src/images/print.png
new file mode 100644
index 0000000..bb65b29
Binary files /dev/null and b/src/images/print.png differ
diff --git a/src/images/print2_big.png b/src/images/print2_big.png
new file mode 100644
index 0000000..0fdb872
Binary files /dev/null and b/src/images/print2_big.png differ
diff --git a/src/images/print_2.png b/src/images/print_2.png
new file mode 100644
index 0000000..774ad17
Binary files /dev/null and b/src/images/print_2.png differ
diff --git a/src/images/print_2_24.png b/src/images/print_2_24.png
new file mode 100644
index 0000000..aeec91f
Binary files /dev/null and b/src/images/print_2_24.png differ
diff --git a/src/images/print_preview.png b/src/images/print_preview.png
new file mode 100644
index 0000000..32a5e02
Binary files /dev/null and b/src/images/print_preview.png differ
diff --git a/src/images/print_preview1.png b/src/images/print_preview1.png
new file mode 100644
index 0000000..7fc0d31
Binary files /dev/null and b/src/images/print_preview1.png differ
diff --git a/src/images/print_preview2.png b/src/images/print_preview2.png
new file mode 100644
index 0000000..f196c43
Binary files /dev/null and b/src/images/print_preview2.png differ
diff --git a/src/images/prior.png b/src/images/prior.png
new file mode 100644
index 0000000..275b99a
Binary files /dev/null and b/src/images/prior.png differ
diff --git a/src/images/prior1.png b/src/images/prior1.png
new file mode 100644
index 0000000..cc71bd5
Binary files /dev/null and b/src/images/prior1.png differ
diff --git a/src/images/prior2.png b/src/images/prior2.png
new file mode 100644
index 0000000..7af6a9c
Binary files /dev/null and b/src/images/prior2.png differ
diff --git a/src/images/redo.png b/src/images/redo.png
new file mode 100644
index 0000000..6c5e773
Binary files /dev/null and b/src/images/redo.png differ
diff --git a/src/images/redo1.png b/src/images/redo1.png
new file mode 100644
index 0000000..89d51fb
Binary files /dev/null and b/src/images/redo1.png differ
diff --git a/src/images/redo_1_16.png b/src/images/redo_1_16.png
new file mode 100644
index 0000000..17f7ac0
Binary files /dev/null and b/src/images/redo_1_16.png differ
diff --git a/src/images/redo_1_24.png b/src/images/redo_1_24.png
new file mode 100644
index 0000000..7ae0543
Binary files /dev/null and b/src/images/redo_1_24.png differ
diff --git a/src/images/rightLine.png b/src/images/rightLine.png
new file mode 100644
index 0000000..d5d85d4
Binary files /dev/null and b/src/images/rightLine.png differ
diff --git a/src/images/rightLine1.png b/src/images/rightLine1.png
new file mode 100644
index 0000000..c7b08bd
Binary files /dev/null and b/src/images/rightLine1.png differ
diff --git a/src/images/save.png b/src/images/save.png
new file mode 100644
index 0000000..80204eb
Binary files /dev/null and b/src/images/save.png differ
diff --git a/src/images/save_1_16.png b/src/images/save_1_16.png
new file mode 100644
index 0000000..4971653
Binary files /dev/null and b/src/images/save_1_16.png differ
diff --git a/src/images/save_1_24.png b/src/images/save_1_24.png
new file mode 100644
index 0000000..621fe37
Binary files /dev/null and b/src/images/save_1_24.png differ
diff --git a/src/images/save_as_1_16.png b/src/images/save_as_1_16.png
new file mode 100644
index 0000000..772e3f6
Binary files /dev/null and b/src/images/save_as_1_16.png differ
diff --git a/src/images/save_as_1_24.png b/src/images/save_as_1_24.png
new file mode 100644
index 0000000..7e2e8fe
Binary files /dev/null and b/src/images/save_as_1_24.png differ
diff --git a/src/images/sendToBack.png b/src/images/sendToBack.png
new file mode 100644
index 0000000..dd6de9e
Binary files /dev/null and b/src/images/sendToBack.png differ
diff --git a/src/images/table.png b/src/images/table.png
new file mode 100644
index 0000000..936e4fc
Binary files /dev/null and b/src/images/table.png differ
diff --git a/src/images/table1.png b/src/images/table1.png
new file mode 100644
index 0000000..09e13ad
Binary files /dev/null and b/src/images/table1.png differ
diff --git a/src/images/text-align-botom.png b/src/images/text-align-botom.png
new file mode 100644
index 0000000..1f7f1bc
Binary files /dev/null and b/src/images/text-align-botom.png differ
diff --git a/src/images/text-align-botom1.png b/src/images/text-align-botom1.png
new file mode 100644
index 0000000..8b67f66
Binary files /dev/null and b/src/images/text-align-botom1.png differ
diff --git a/src/images/text-align-justify.png b/src/images/text-align-justify.png
new file mode 100644
index 0000000..1aa7188
Binary files /dev/null and b/src/images/text-align-justify.png differ
diff --git a/src/images/text-align-justify1.png b/src/images/text-align-justify1.png
new file mode 100644
index 0000000..69cbb4f
Binary files /dev/null and b/src/images/text-align-justify1.png differ
diff --git a/src/images/text-align-top.png b/src/images/text-align-top.png
new file mode 100644
index 0000000..fe6bbb5
Binary files /dev/null and b/src/images/text-align-top.png differ
diff --git a/src/images/text-align-top1.png b/src/images/text-align-top1.png
new file mode 100644
index 0000000..b44ed19
Binary files /dev/null and b/src/images/text-align-top1.png differ
diff --git a/src/images/text-align-v-center.png b/src/images/text-align-v-center.png
new file mode 100644
index 0000000..b505637
Binary files /dev/null and b/src/images/text-align-v-center.png differ
diff --git a/src/images/text-align-v-center1.png b/src/images/text-align-v-center1.png
new file mode 100644
index 0000000..7b56ffb
Binary files /dev/null and b/src/images/text-align-v-center1.png differ
diff --git a/src/images/text_align_center.png b/src/images/text_align_center.png
new file mode 100644
index 0000000..57beb38
Binary files /dev/null and b/src/images/text_align_center.png differ
diff --git a/src/images/text_align_center1.png b/src/images/text_align_center1.png
new file mode 100644
index 0000000..d903ecc
Binary files /dev/null and b/src/images/text_align_center1.png differ
diff --git a/src/images/text_align_left.png b/src/images/text_align_left.png
new file mode 100644
index 0000000..6c8fcc1
Binary files /dev/null and b/src/images/text_align_left.png differ
diff --git a/src/images/text_align_left1.png b/src/images/text_align_left1.png
new file mode 100644
index 0000000..a6ac107
Binary files /dev/null and b/src/images/text_align_left1.png differ
diff --git a/src/images/text_align_right.png b/src/images/text_align_right.png
new file mode 100644
index 0000000..a150257
Binary files /dev/null and b/src/images/text_align_right.png differ
diff --git a/src/images/text_align_right1.png b/src/images/text_align_right1.png
new file mode 100644
index 0000000..24bf51b
Binary files /dev/null and b/src/images/text_align_right1.png differ
diff --git a/src/images/text_bold.png b/src/images/text_bold.png
new file mode 100644
index 0000000..889ae80
Binary files /dev/null and b/src/images/text_bold.png differ
diff --git a/src/images/text_bold1.png b/src/images/text_bold1.png
new file mode 100644
index 0000000..379d525
Binary files /dev/null and b/src/images/text_bold1.png differ
diff --git a/src/images/text_italic.png b/src/images/text_italic.png
new file mode 100644
index 0000000..8482ac8
Binary files /dev/null and b/src/images/text_italic.png differ
diff --git a/src/images/text_italic1.png b/src/images/text_italic1.png
new file mode 100644
index 0000000..e8ec97c
Binary files /dev/null and b/src/images/text_italic1.png differ
diff --git a/src/images/text_underline.png b/src/images/text_underline.png
new file mode 100644
index 0000000..90d0df2
Binary files /dev/null and b/src/images/text_underline.png differ
diff --git a/src/images/text_underline1.png b/src/images/text_underline1.png
new file mode 100644
index 0000000..dfd9e37
Binary files /dev/null and b/src/images/text_underline1.png differ
diff --git a/src/images/toBack.png b/src/images/toBack.png
new file mode 100644
index 0000000..87300a3
Binary files /dev/null and b/src/images/toBack.png differ
diff --git a/src/images/toBottom.png b/src/images/toBottom.png
new file mode 100644
index 0000000..e8e8bd3
Binary files /dev/null and b/src/images/toBottom.png differ
diff --git a/src/images/toCenter.png b/src/images/toCenter.png
new file mode 100644
index 0000000..ebc5df9
Binary files /dev/null and b/src/images/toCenter.png differ
diff --git a/src/images/toFront.png b/src/images/toFront.png
new file mode 100644
index 0000000..cd4f770
Binary files /dev/null and b/src/images/toFront.png differ
diff --git a/src/images/toLeft1.png b/src/images/toLeft1.png
new file mode 100644
index 0000000..8277458
Binary files /dev/null and b/src/images/toLeft1.png differ
diff --git a/src/images/toRight.png b/src/images/toRight.png
new file mode 100644
index 0000000..60d1f0f
Binary files /dev/null and b/src/images/toRight.png differ
diff --git a/src/images/toSameHeight.png b/src/images/toSameHeight.png
new file mode 100644
index 0000000..823f08c
Binary files /dev/null and b/src/images/toSameHeight.png differ
diff --git a/src/images/toSameWidth.png b/src/images/toSameWidth.png
new file mode 100644
index 0000000..272be6b
Binary files /dev/null and b/src/images/toSameWidth.png differ
diff --git a/src/images/toTop.png b/src/images/toTop.png
new file mode 100644
index 0000000..7d4ffbc
Binary files /dev/null and b/src/images/toTop.png differ
diff --git a/src/images/toVCernter.png b/src/images/toVCernter.png
new file mode 100644
index 0000000..bbe5110
Binary files /dev/null and b/src/images/toVCernter.png differ
diff --git a/src/images/to_bottom.png b/src/images/to_bottom.png
new file mode 100644
index 0000000..00ae931
Binary files /dev/null and b/src/images/to_bottom.png differ
diff --git a/src/images/to_bottom_2.png b/src/images/to_bottom_2.png
new file mode 100644
index 0000000..1161c42
Binary files /dev/null and b/src/images/to_bottom_2.png differ
diff --git a/src/images/to_center.png b/src/images/to_center.png
new file mode 100644
index 0000000..edd8a94
Binary files /dev/null and b/src/images/to_center.png differ
diff --git a/src/images/to_center_2.png b/src/images/to_center_2.png
new file mode 100644
index 0000000..78b4935
Binary files /dev/null and b/src/images/to_center_2.png differ
diff --git a/src/images/to_h_center.png b/src/images/to_h_center.png
new file mode 100644
index 0000000..0e5b0f6
Binary files /dev/null and b/src/images/to_h_center.png differ
diff --git a/src/images/to_h_center_2.png b/src/images/to_h_center_2.png
new file mode 100644
index 0000000..30679ff
Binary files /dev/null and b/src/images/to_h_center_2.png differ
diff --git a/src/images/to_left.png b/src/images/to_left.png
new file mode 100644
index 0000000..1427073
Binary files /dev/null and b/src/images/to_left.png differ
diff --git a/src/images/to_left_2.png b/src/images/to_left_2.png
new file mode 100644
index 0000000..c04d56a
Binary files /dev/null and b/src/images/to_left_2.png differ
diff --git a/src/images/to_right.png b/src/images/to_right.png
new file mode 100644
index 0000000..4b9e5e9
Binary files /dev/null and b/src/images/to_right.png differ
diff --git a/src/images/to_right_2.png b/src/images/to_right_2.png
new file mode 100644
index 0000000..5ec05c6
Binary files /dev/null and b/src/images/to_right_2.png differ
diff --git a/src/images/to_same_height.png b/src/images/to_same_height.png
new file mode 100644
index 0000000..db1bb6b
Binary files /dev/null and b/src/images/to_same_height.png differ
diff --git a/src/images/to_same_height_2.png b/src/images/to_same_height_2.png
new file mode 100644
index 0000000..eda1bda
Binary files /dev/null and b/src/images/to_same_height_2.png differ
diff --git a/src/images/to_same_width.png b/src/images/to_same_width.png
new file mode 100644
index 0000000..b339939
Binary files /dev/null and b/src/images/to_same_width.png differ
diff --git a/src/images/to_same_width_2.png b/src/images/to_same_width_2.png
new file mode 100644
index 0000000..4f1b976
Binary files /dev/null and b/src/images/to_same_width_2.png differ
diff --git a/src/images/to_top.png b/src/images/to_top.png
new file mode 100644
index 0000000..4e9415f
Binary files /dev/null and b/src/images/to_top.png differ
diff --git a/src/images/to_top_2.png b/src/images/to_top_2.png
new file mode 100644
index 0000000..85bed49
Binary files /dev/null and b/src/images/to_top_2.png differ
diff --git a/src/images/topLine.png b/src/images/topLine.png
new file mode 100644
index 0000000..132b249
Binary files /dev/null and b/src/images/topLine.png differ
diff --git a/src/images/topLine1.png b/src/images/topLine1.png
new file mode 100644
index 0000000..a9cda53
Binary files /dev/null and b/src/images/topLine1.png differ
diff --git a/src/images/undo.png b/src/images/undo.png
new file mode 100644
index 0000000..a0da695
Binary files /dev/null and b/src/images/undo.png differ
diff --git a/src/images/undo1.png b/src/images/undo1.png
new file mode 100644
index 0000000..805b474
Binary files /dev/null and b/src/images/undo1.png differ
diff --git a/src/images/undo_1_16.png b/src/images/undo_1_16.png
new file mode 100644
index 0000000..d4835eb
Binary files /dev/null and b/src/images/undo_1_16.png differ
diff --git a/src/images/undo_1_24.png b/src/images/undo_1_24.png
new file mode 100644
index 0000000..d2ce600
Binary files /dev/null and b/src/images/undo_1_24.png differ
diff --git a/src/images/value.png b/src/images/value.png
new file mode 100644
index 0000000..32660c9
Binary files /dev/null and b/src/images/value.png differ
diff --git a/src/images/var1.png b/src/images/var1.png
new file mode 100644
index 0000000..c3db99f
Binary files /dev/null and b/src/images/var1.png differ
diff --git a/src/images/variable.png b/src/images/variable.png
new file mode 100644
index 0000000..054cb8d
Binary files /dev/null and b/src/images/variable.png differ
diff --git a/src/images/variable1.png b/src/images/variable1.png
new file mode 100644
index 0000000..3a1d537
Binary files /dev/null and b/src/images/variable1.png differ
diff --git a/src/images/vlayout.png b/src/images/vlayout.png
new file mode 100644
index 0000000..09ef05c
Binary files /dev/null and b/src/images/vlayout.png differ
diff --git a/src/images/zoom-in_1_16.png b/src/images/zoom-in_1_16.png
new file mode 100644
index 0000000..4ec3c28
Binary files /dev/null and b/src/images/zoom-in_1_16.png differ
diff --git a/src/images/zoom-in_1_24.png b/src/images/zoom-in_1_24.png
new file mode 100644
index 0000000..9300db4
Binary files /dev/null and b/src/images/zoom-in_1_24.png differ
diff --git a/src/images/zoom-in_2_16.png b/src/images/zoom-in_2_16.png
new file mode 100644
index 0000000..e41e780
Binary files /dev/null and b/src/images/zoom-in_2_16.png differ
diff --git a/src/images/zoom-out_1_16.png b/src/images/zoom-out_1_16.png
new file mode 100644
index 0000000..39dc346
Binary files /dev/null and b/src/images/zoom-out_1_16.png differ
diff --git a/src/images/zoom-out_1_24.png b/src/images/zoom-out_1_24.png
new file mode 100644
index 0000000..01c6965
Binary files /dev/null and b/src/images/zoom-out_1_24.png differ
diff --git a/src/images/zoom_in.png b/src/images/zoom_in.png
new file mode 100644
index 0000000..71cacec
Binary files /dev/null and b/src/images/zoom_in.png differ
diff --git a/src/images/zoom_in1.png b/src/images/zoom_in1.png
new file mode 100644
index 0000000..ec2d692
Binary files /dev/null and b/src/images/zoom_in1.png differ
diff --git a/src/images/zoom_out.png b/src/images/zoom_out.png
new file mode 100644
index 0000000..bcd9e3d
Binary files /dev/null and b/src/images/zoom_out.png differ
diff --git a/src/images/zoom_out1.png b/src/images/zoom_out1.png
new file mode 100644
index 0000000..a6beee7
Binary files /dev/null and b/src/images/zoom_out1.png differ
diff --git a/src/items/abordertextitem.cpp b/src/items/abordertextitem.cpp
new file mode 100644
index 0000000..f322627
--- /dev/null
+++ b/src/items/abordertextitem.cpp
@@ -0,0 +1,323 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include
+#include
+
+#include "apagedesignintf.h"
+#include "abordertextitem.h"
+#include "adesignelementsfactory.h"
+#include "aglobal.h"
+#include "adatasourcemanager.h"
+#include "asimpletagparser.h"
+
+namespace{
+
+const QString xmlTag = "TextItem";
+
+ArReport::BaseDesignIntf * createTextItem(QObject* owner, ArReport::BaseDesignIntf* parent){
+ return new ArReport::TextItem(owner,parent);
+}
+bool registred = ArReport::DesignElementsFactory::instance().registerCreator(xmlTag, ArReport::ItemAttribs(QObject::tr("Text Item"),"TextItem"), createTextItem);
+
+}
+
+namespace ArReport{
+
+TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
+ : ItemDesignIntf(xmlTag,owner,parent),m_spaceBorder(4){
+ m_text = new QTextDocument();
+ Init();
+}
+
+TextItem::TextItem(const QString& text, QObject* owner /*= 0*/, QGraphicsItem* parent /*= 0*/)
+ :ItemDesignIntf(xmlTag, owner,parent),m_spaceBorder(4){
+ m_strText = text;
+ m_text = new QTextDocument(text);
+ m_text->setHtml(m_strText);
+ initText();
+ Init();
+}
+
+TextItem::~TextItem()
+{
+ delete m_text;
+}
+
+void TextItem::paint(QPainter* ppainter, const QStyleOptionGraphicsItem* style, QWidget* widget) {
+ Q_UNUSED(widget);
+ Q_UNUSED(style);
+
+ ppainter->save();
+
+ setupPainter(ppainter);
+
+ if (isSelected()) {
+ ppainter->setOpacity(0);
+ ppainter->fillRect(rect(),QBrush(QColor(Qt::white)));
+ ppainter->setOpacity(1);
+ }
+ else ppainter->fillRect(rect(),QBrush(Qt::white));
+
+ //initText();
+
+ QSizeF tmpSize = rect().size()-m_textSize;//m_text->size();
+
+ if ((tmpSize.height()>0) && (m_alignment & Qt::AlignVCenter))
+ ppainter->translate(0,tmpSize.height()/2);
+
+ QRegion clipReg=ppainter->clipRegion().xored(ppainter->clipRegion().subtracted(rect().toRect()));
+ ppainter->setClipRegion(clipReg);
+ qreal pos=0;
+ for(QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){
+ for (int i=0;ilineCount();i++){
+ pos+=it.layout()->lineAt(i).height();
+ it.layout()->lineAt(i).draw(ppainter,QPointF(spaceBorderSize(),0));
+ }
+ }
+
+ ppainter->restore();
+ BaseDesignIntf::paint(ppainter, style, widget);
+}
+
+QString TextItem::text() const{
+ return m_strText;
+}
+
+void TextItem::Init()
+{
+ //setFlag(QGraphicsItem::ItemIsMovable);
+ //setFlag(QGraphicsItem::ItemIsSelectable);
+ m_autoWidth=NoneAutoWidth;
+ m_alignment= Qt::AlignLeft|Qt::AlignTop;
+ m_autoHeight=false;
+ m_text->setDefaultFont(sceneFont());
+ m_textSize=QSizeF();
+}
+
+void TextItem::setText(QString value)
+{
+ if (m_strText.compare(value)!=0){
+ m_strText=value;
+ m_text->setHtml(value);
+ m_text->setTextWidth(width());
+ m_textSize=m_text->size();
+ if (!isLoading()){
+ update(rect());
+ }
+ }
+}
+
+void TextItem::updateItemSize(RenderPass pass, int /*maxHeight*/)
+{
+ if (isNeedExpandContent())
+ expandContent(pass);
+ initText();
+
+ if (m_textSize.width()>width() && (m_autoWidth==MaxWordLength)){
+ setWidth(m_textSize.width());
+ }
+ if ((m_textSize.height()>height()) && (m_autoHeight) ){
+ setHeight(m_textSize.height()+5);
+ }
+}
+
+void TextItem::updateLayout()
+{
+ m_layout.setText(text());
+ qreal linePos = 0;
+ m_layout.beginLayout();
+ while(true){
+ QTextLine line = m_layout.createLine();
+ if (!line.isValid()) break;
+ line.setLineWidth(width()-m_spaceBorder*2);
+ line.setPosition(QPoint(m_spaceBorder,linePos));
+ linePos+=line.height();
+ }
+ m_layout.endLayout();
+}
+
+bool TextItem::isNeedExpandContent() const
+{
+ QRegExp rx("$*\\{[^{]*\\}");
+ return text().contains(rx);
+}
+
+QString TextItem::expandDataFields(QString context)
+{
+ DataManager* dm=DataManager::instance();
+ QRegExp rx("\\$D\\{[^\\{]*\\}");
+ if (context.contains(rx)){
+
+ while ((rx.indexIn(context))!=-1){
+ QString field=rx.cap(0);
+ field.remove("$D{");
+ field.remove("}");
+ if (dm->isContainField(field)) {
+ context.replace(rx.cap(0),dm->fieldData(field).toString());
+ } else {
+ context.replace(rx.cap(0),tr("Field %1 not found").arg(field));
+ }
+ }
+ }
+ return context;
+}
+
+void TextItem::initText()
+{
+ QTextOption to;
+ to.setAlignment(m_alignment);
+ to.setWrapMode(QTextOption::WordWrap);
+ m_text->setDocumentMargin(spaceBorderSize());
+ m_text->setDefaultTextOption(to);
+ m_text->setDefaultFont(sceneFont());
+ m_text->setTextWidth(rect().width());
+ m_textSize=m_text->size();
+}
+
+void TextItem::setGeometry(QRectF rect)
+{
+ BaseDesignIntf::setGeometry(rect);
+ m_text->setTextWidth(width());
+}
+
+bool TextItem::isNeedUpdateSize() const
+{
+ return ((m_textSize.height()>geometry().height()||m_textSize.width()>geometry().width())&&
+ (autoHeight()||autoWidth()))
+ || isNeedExpandContent();
+}
+
+void TextItem::setSpaceBorderSize(int value)
+{
+ m_spaceBorder=value;
+ update(rect());
+}
+
+void TextItem::setAlignment(Qt::Alignment value)
+{
+ m_alignment=value;
+ m_layout.setTextOption(QTextOption(m_alignment));
+ update(rect());
+}
+
+void TextItem::expandContent(RenderPass pass)
+{
+ QString context=text();
+ switch(pass){
+ case FirstPass:
+ context=expandDataFields(context);
+ break;
+ case SecondPass:;
+ }
+ setText(context);
+}
+
+bool TextItem::canBeSliced(int height) const
+{
+ return height>(m_text->begin().layout()->lineAt(0).height());
+}
+
+BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
+{
+ int linesHeight=0;
+ initText();
+ QString tmpText="";
+ TextItem* upperPart = dynamic_cast(cloneItem(itemMode(),owner,parent));
+
+ for (QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){
+ for (int i=0;ilineCount();i++){
+ linesHeight+=it.layout()->lineAt(i).height();
+ if ((linesHeight>height)) {linesHeight-=it.layout()->lineAt(i).height(); goto loop_exit;}
+ tmpText+=it.text().mid(it.layout()->lineAt(i).textStart(),it.layout()->lineAt(i).textLength());
+ }
+ }
+ loop_exit:
+ upperPart->setHeight(linesHeight);
+ QScopedPointer context(new HtmlContext(m_strText));
+ upperPart->setText(context->extendTextByTags(tmpText,0));
+ return upperPart;
+}
+
+BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent)
+{
+ TextItem* bottomPart = dynamic_cast(cloneItem(itemMode(),owner,parent));
+ int linesHeight=0;
+ int curLine=0;
+ QTextBlock curBlock;
+
+ QString tmpText="";
+
+ for (curBlock=m_text->begin();curBlock!=m_text->end();curBlock=curBlock.next()){
+ for (curLine=0;curLinelineCount();curLine++){
+ linesHeight+=curBlock.layout()->lineAt(curLine).height();
+ if (linesHeight>height) {goto loop_exit;}
+ }
+ }
+ loop_exit:;
+ int textPos=0;
+ for (;curBlock!=m_text->end();curBlock=curBlock.next()){
+ for (;curLinelineCount();curLine++){
+ if (tmpText=="") textPos= curBlock.layout()->lineAt(curLine).textStart();
+ tmpText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
+ curBlock.layout()->lineAt(curLine).textLength());
+ }
+ }
+ QScopedPointer context(new HtmlContext(m_strText));
+ bottomPart->setText(context->extendTextByTags(tmpText,textPos));
+ return bottomPart;
+}
+
+BaseDesignIntf *TextItem::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new TextItem(owner,parent);
+}
+
+BaseDesignIntf *TextItem::cloneEmpty(int height, QObject *owner, QGraphicsItem *parent)
+{
+ TextItem* empty=dynamic_cast(cloneItem(itemMode(),owner,parent));
+ empty->setText("");
+ empty->setHeight(height);
+ return empty;
+}
+
+void TextItem::objectLoadFinished()
+{
+ ItemDesignIntf::objectLoadFinished();
+ initText();
+}
+
+void TextItem::setTextItemFont(QFont value)
+{
+ setFont(value);
+ m_text->setDefaultFont(sceneFont());
+}
+
+}
+
diff --git a/src/items/abordertextitem.h b/src/items/abordertextitem.h
new file mode 100644
index 0000000..cc9bdee
--- /dev/null
+++ b/src/items/abordertextitem.h
@@ -0,0 +1,110 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef ABORDERTEXTITEM_H
+#define ABORDERTEXTITEM_H
+#include
+#include
+#include
+#include "aitemdesignintf.h"
+#include
+
+#include
+
+namespace ArReport {
+
+class Tag;
+class TextItem : public ArReport::ItemDesignIntf {
+ Q_OBJECT
+ Q_ENUMS(AutoWidth)
+ Q_PROPERTY(QString content READ text WRITE setText)
+ Q_PROPERTY(int margin READ spaceBorderSize WRITE setSpaceBorderSize)
+ Q_PROPERTY(Qt::Alignment alignment READ alignment() WRITE setAlignment)
+ Q_PROPERTY(AutoWidth autoWidth READ autoWidth() WRITE setAutoWidth())
+ Q_PROPERTY(bool autoHeight READ autoHeight() WRITE setAutoHeight())
+ Q_PROPERTY(QFont font READ font() WRITE setTextItemFont())
+public:
+
+ enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
+
+ void Init();
+ TextItem(QObject* owner,QGraphicsItem* parent);
+ TextItem(const QString& text,QObject* owner = 0, QGraphicsItem* parent = 0);
+ ~TextItem();
+
+ void paint(QPainter* ppainter, const QStyleOptionGraphicsItem*, QWidget*);
+ QString text() const;
+ void setText(QString value);
+
+ void setSpaceBorderSize(int value);
+ int spaceBorderSize() const {return m_spaceBorder;}
+
+ void setAlignment(Qt::Alignment value);
+ Qt::Alignment alignment(){return m_alignment;}
+
+ virtual void setGeometry(QRectF rect);
+ virtual bool isNeedUpdateSize() const;
+ virtual void updateItemSize(RenderPass pass, int);
+ void expandContent(RenderPass pass);
+
+ void setAutoHeight(bool value){m_autoHeight=value;}
+ bool autoHeight() const {return m_autoHeight;}
+
+ void setAutoWidth(AutoWidth value){m_autoWidth=value;}
+ AutoWidth autoWidth() const {return m_autoWidth;}
+
+ virtual bool canBeSliced(int height) const;
+ virtual bool isEmpty() const{return m_text->isEmpty();}
+ virtual BaseDesignIntf* cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent);
+ virtual BaseDesignIntf* cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent);
+ virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
+ virtual BaseDesignIntf* cloneEmpty(int height, QObject *owner, QGraphicsItem *parent);
+ virtual void objectLoadFinished();
+
+ void setTextItemFont(QFont value);
+protected:
+ void updateLayout();
+ bool isNeedExpandContent() const;
+ QString expandDataFields(QString context);
+private:
+ void initText();
+private:
+ QString m_strText;
+ int m_spaceBorder;
+ QTextLayout m_layout;
+ QTextDocument* m_text;
+ Qt::Alignment m_alignment;
+ bool m_autoHeight;
+ AutoWidth m_autoWidth;
+ QSizeF m_textSize;
+ QFont m_font;
+};
+
+}
+#endif // ABORDERTEXTITEM_H
diff --git a/src/items/editors/lrfonteditorwidget.cpp b/src/items/editors/lrfonteditorwidget.cpp
new file mode 100644
index 0000000..2fbb96e
--- /dev/null
+++ b/src/items/editors/lrfonteditorwidget.cpp
@@ -0,0 +1,147 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrfonteditorwidget.h"
+
+namespace LimeReport{
+
+FontEditorWidget::FontEditorWidget(ReportDesignWidget *reportEditor, const QString &title, QWidget *parent)
+ : ItemEditorWidget(reportEditor,title,parent), m_ignoreSlots(false) {
+ initEditor();
+}
+
+FontEditorWidget::FontEditorWidget(ReportDesignWidget *reportEditor, QWidget *parent)
+ :ItemEditorWidget(reportEditor,parent), m_ignoreSlots(false) {
+ initEditor();
+}
+
+void FontEditorWidget::setItemEvent(BaseDesignIntf* item)
+{
+
+ QVariant font=item->property("font");
+ if (font.isValid()){
+ updateValues(font.value());
+ setEnabled(true);
+ }
+
+}
+
+void FontEditorWidget::initEditor()
+{
+ setIconSize(QSize(24,24));
+ setAllowedAreas(Qt::TopToolBarArea);
+ setFloatable(false);
+
+ m_fontNameEditor = new QFontComboBox(this);
+ m_fontNameEditor->setFontFilters(QFontComboBox::AllFonts);
+ connect(m_fontNameEditor,SIGNAL(currentFontChanged(QFont)),this,SLOT(slotFontChanged(QFont)));
+ addWidget(m_fontNameEditor);
+
+ m_fontSizeModel.setStringList(QStringList()<<"6"<<"7"<<"8"<<"9"<<"10"<<"11"<<"12"<<"14"<<"16"<<"18"<<"20"<<"24"<<"28"<<"30"<<"36"<<"48"<<"64"<<"72");
+ m_fontSizeEditor = new QComboBox(this);
+ m_fontSizeEditor->setModel(&m_fontSizeModel);
+ m_fontSizeEditor->setEditable(true);
+ connect(m_fontSizeEditor,SIGNAL(currentIndexChanged(QString)),this,SLOT(slotFontSizeChanged(QString)));
+ addWidget(m_fontSizeEditor);
+
+ addSeparator();
+ setEnabled(false);
+
+ m_fontBold = new QAction(tr("Font bold"),this);
+ m_fontBold->setIcon(QIcon(":/report/images/textBold"));
+ m_fontBold->setCheckable(true);
+ connect(m_fontBold,SIGNAL(toggled(bool)),this,SLOT(slotFontAttribsChanged(bool)));
+ addAction(m_fontBold);
+
+ m_fontItalic = new QAction(tr("Font Italic"),this);
+ m_fontItalic->setIcon(QIcon(":/report/images/textItalic"));
+ m_fontItalic->setCheckable(true);
+ connect(m_fontItalic,SIGNAL(toggled(bool)),this,SLOT(slotFontAttribsChanged(bool)));
+ addAction(m_fontItalic);
+
+ m_fontUnderline = new QAction(tr("Font Underline"),this);
+ m_fontUnderline->setIcon(QIcon(":/report/images/textUnderline"));
+ m_fontUnderline->setCheckable(true);
+ connect(m_fontUnderline,SIGNAL(toggled(bool)),this,SLOT(slotFontAttribsChanged(bool)));
+ addAction(m_fontUnderline);
+
+ if (reportEditor()){
+ connect(reportEditor(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
+ this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
+ }
+}
+
+void FontEditorWidget::updateValues(const QFont& font)
+{
+ m_ignoreSlots=true;
+ m_fontNameEditor->setCurrentFont(font);
+ m_fontSizeEditor->setEditText(QString::number(font.pointSize()));
+ m_fontBold->setChecked(font.bold());
+ m_fontItalic->setChecked(font.italic());
+ m_fontUnderline->setChecked(font.underline());
+ m_ignoreSlots=false;
+}
+
+
+void FontEditorWidget::slotFontChanged(const QFont &font)
+{
+ if (reportEditor() && !m_ignoreSlots) reportEditor()->setFont(font);
+}
+
+void FontEditorWidget::slotFontSizeChanged(const QString &value)
+{
+ if (reportEditor() && !m_ignoreSlots){
+ QFont resFont(m_fontNameEditor->currentFont());
+ resFont.setPointSize(value.toInt());
+ reportEditor()->setFont(resFont);
+ }
+}
+
+void FontEditorWidget::slotFontAttribsChanged(bool)
+{
+ if (reportEditor()&& !m_ignoreSlots){
+ QFont resFont(m_fontNameEditor->currentFont());
+ resFont.setBold(m_fontBold->isChecked());
+ resFont.setItalic(m_fontItalic->isChecked());
+ resFont.setUnderline(m_fontUnderline->isChecked());
+ reportEditor()->setFont(resFont);
+ }
+}
+
+void FontEditorWidget::slotPropertyChanged(const QString &objectName, const QString &property, const QVariant& oldValue, const QVariant& newValue)
+{
+ Q_UNUSED(oldValue)
+ Q_UNUSED(newValue)
+ if (item()&&(item()->objectName()==objectName)&&(property=="font")){
+ updateValues(item()->property("font").value());
+ }
+}
+
+
+} //namespace LimeReport
diff --git a/src/items/editors/lrfonteditorwidget.h b/src/items/editors/lrfonteditorwidget.h
new file mode 100644
index 0000000..eb7864e
--- /dev/null
+++ b/src/items/editors/lrfonteditorwidget.h
@@ -0,0 +1,73 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRFONTEDITORWIDGET_H
+#define LRFONTEDITORWIDGET_H
+
+#include
+#include
+#include
+#include
+
+#include "lrreportdesignwidget.h"
+#include "lritemeditorwidget.h"
+
+namespace LimeReport{
+
+class FontEditorWidget :public ItemEditorWidget{
+ Q_OBJECT
+public:
+ explicit FontEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
+ explicit FontEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
+protected:
+ void setItemEvent(BaseDesignIntf *item);
+private slots:
+ void slotFontChanged(const QFont& font);
+ void slotFontSizeChanged(const QString& value);
+ void slotFontAttribsChanged(bool);
+ void slotPropertyChanged(const QString& objectName, const QString& property, const QVariant &oldValue, const QVariant &newValue);
+private:
+ void initEditor();
+ void updateValues(const QFont &font);
+
+ QFontComboBox* m_fontNameEditor;
+ QComboBox* m_fontSizeEditor;
+ QStringListModel m_fontSizeModel;
+
+ QAction* m_fontBold;
+ QAction* m_fontItalic;
+ QAction* m_fontUnderline;
+
+ bool m_ignoreSlots;
+
+};
+
+} //namespace LimeReport
+
+#endif // LRFONTEDITORWIDGET_H
diff --git a/src/items/editors/lritemeditorwidget.cpp b/src/items/editors/lritemeditorwidget.cpp
new file mode 100644
index 0000000..d335697
--- /dev/null
+++ b/src/items/editors/lritemeditorwidget.cpp
@@ -0,0 +1,91 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lritemeditorwidget.h"
+
+namespace LimeReport{
+
+ItemEditorWidget::ItemEditorWidget(ReportDesignWidget* reportEditor, const QString& title, QWidget* parent)
+ :QToolBar(title,parent), m_reportEditor(reportEditor), m_item(0), m_page(0)
+{
+}
+
+ItemEditorWidget::ItemEditorWidget(ReportDesignWidget* reportEditor, QWidget* parent)
+ :QToolBar(parent), m_reportEditor(reportEditor), m_item(0), m_page(0)
+{
+}
+
+ItemEditorWidget::ItemEditorWidget(PageDesignIntf* page, const QString& title, QWidget* parent)
+ :QToolBar(title,parent), m_reportEditor(0), m_item(0), m_page(page)
+{
+}
+
+ItemEditorWidget::ItemEditorWidget(PageDesignIntf* page, QWidget* parent)
+ :QToolBar(parent), m_reportEditor(0), m_item(0), m_page(page)
+{
+}
+
+void ItemEditorWidget::setItem(BaseDesignIntf* item)
+{
+ if (m_item!=item){
+ if (m_item) m_item->disconnect(this);
+ m_item=item;
+ connect(m_item,SIGNAL(destroyed(QObject*)),this,SLOT(slotItemDestroyed(QObject*)));
+ connect(m_item,SIGNAL(propertyChanged(QString,QVariant,QVariant)),
+ this,SLOT(slotPropertyChanged(QString,QVariant,QVariant)));
+ setEnabled(false);
+ setItemEvent(item);
+ }
+}
+
+void ItemEditorWidget::properyChangedEvent(const QString& propertName, const QVariant& oldValue, const QVariant& newValue)
+{
+ Q_UNUSED(propertName)
+ Q_UNUSED(oldValue)
+ Q_UNUSED(newValue)
+}
+
+void ItemEditorWidget::slotItemDestroyed(QObject* item)
+{
+ if (item==m_item) {
+ m_item = 0;
+ setEnabled(false);
+ }
+}
+
+void ItemEditorWidget::slotPropertyChanged(const QString& propertName, const QVariant& oldValue, const QVariant& newValue)
+{
+ properyChangedEvent(propertName,oldValue,newValue);
+}
+
+}
+
+
+
+
diff --git a/src/items/editors/lritemeditorwidget.h b/src/items/editors/lritemeditorwidget.h
new file mode 100644
index 0000000..5214756
--- /dev/null
+++ b/src/items/editors/lritemeditorwidget.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRITEMEDITORWIDGET_H
+#define LRITEMEDITORWIDGET_H
+
+#include
+#include "lrreportdesignwidget.h"
+
+namespace LimeReport {
+
+class ItemEditorWidget : public QToolBar
+{
+ Q_OBJECT
+public:
+ explicit ItemEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
+ explicit ItemEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
+ explicit ItemEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0);
+ explicit ItemEditorWidget(PageDesignIntf* page, QWidget *parent = 0);
+
+ void setItem(BaseDesignIntf *item);
+ void setReportEditor(ReportDesignWidget* editor){m_reportEditor = editor;}
+protected:
+ virtual void setItemEvent(BaseDesignIntf*){}
+ virtual void properyChangedEvent(const QString& propertName, const QVariant& oldValue, const QVariant& newValue);
+ BaseDesignIntf* item(){return m_item;}
+ ReportDesignWidget* reportEditor(){return m_reportEditor;}
+ PageDesignIntf* page(){return m_page;}
+private slots:
+ void slotItemDestroyed(QObject* item);
+ void slotPropertyChanged(const QString& propertName, const QVariant& oldValue, const QVariant& newValue);
+private:
+ ReportDesignWidget* m_reportEditor;
+ BaseDesignIntf* m_item;
+ PageDesignIntf* m_page;
+};
+
+} // namespace LimeReport
+#endif // LRITEMEDITORWIDGET_H
diff --git a/src/items/editors/lritemsaligneditorwidget.cpp b/src/items/editors/lritemsaligneditorwidget.cpp
new file mode 100644
index 0000000..e4c681f
--- /dev/null
+++ b/src/items/editors/lritemsaligneditorwidget.cpp
@@ -0,0 +1,171 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lritemsaligneditorwidget.h"
+
+namespace LimeReport{
+
+ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(LimeReport::ReportDesignWidget* reportEditor, const QString& title, QWidget* parent)
+ :QToolBar(title,parent), m_reportEditor(reportEditor), m_page(0)
+{
+ initEditor();
+}
+
+ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(ReportDesignWidget* reportEditor, QWidget* parent)
+ :QToolBar(parent), m_reportEditor(reportEditor), m_page(0)
+{
+ initEditor();
+}
+
+ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(PageDesignIntf* page, const QString& title, QWidget* parent)
+ :QToolBar(title,parent), m_reportEditor(0), m_page(page)
+{
+ initEditor();
+}
+
+ItemsAlignmentEditorWidget::ItemsAlignmentEditorWidget(PageDesignIntf* page, QWidget* parent)
+ :QToolBar(parent), m_reportEditor(0), m_page(page)
+{
+ initEditor();
+}
+
+void ItemsAlignmentEditorWidget::slotBrinToFront()
+{
+ if (m_reportEditor) m_reportEditor->brinToFront();
+ if (m_page) m_page->bringToFront();
+}
+
+void ItemsAlignmentEditorWidget::slotSendToBack()
+{
+ if (m_reportEditor) m_reportEditor->sendToBack();
+ if (m_page) m_page->sendToBack();
+}
+
+void ItemsAlignmentEditorWidget::slotAlignToLeft()
+{
+ if (m_reportEditor) m_reportEditor->alignToLeft();
+ if (m_page) m_page->alignToLeft();
+}
+
+void ItemsAlignmentEditorWidget::slotAlignToRight()
+{
+ if (m_reportEditor) m_reportEditor->alignToRight();
+ if (m_page) m_page->alignToRigth();
+}
+
+void ItemsAlignmentEditorWidget::slotAlignToVCenter()
+{
+ if (m_reportEditor) m_reportEditor->alignToVCenter();
+ if (m_page) m_page->alignToVCenter();
+}
+
+void ItemsAlignmentEditorWidget::slotAlignToTop()
+{
+ if (m_reportEditor) m_reportEditor->alignToTop();
+ if (m_page) m_page->alignToTop();
+}
+
+void ItemsAlignmentEditorWidget::slotAlignToBottom()
+{
+ if (m_reportEditor) m_reportEditor->alignToBottom();
+ if (m_page) m_page->alignToBottom();
+}
+
+void ItemsAlignmentEditorWidget::slotAlignToHCenter()
+{
+ if (m_reportEditor) m_reportEditor->alignToHCenter();
+ if (m_page) m_page->alignToHCenter();
+}
+
+void ItemsAlignmentEditorWidget::slotSameHeight()
+{
+ if (m_reportEditor) m_reportEditor->sameHeight();
+ if (m_page) m_page->sameHeight();
+}
+
+void ItemsAlignmentEditorWidget::slotSameWidth()
+{
+ if (m_reportEditor) m_reportEditor->sameWidth();
+ if (m_page) m_page->sameWidth();
+}
+
+void ItemsAlignmentEditorWidget::initEditor()
+{
+ m_bringToFront = new QAction(tr("Bring to top"),this);
+ m_bringToFront->setIcon(QIcon(":/report/images/bringToTop"));
+ connect(m_bringToFront,SIGNAL(triggered()),this,SLOT(slotBrinToFront()));
+ addAction(m_bringToFront);
+
+ m_sendToBack = new QAction(tr("Send to back"),this);
+ m_sendToBack->setIcon(QIcon(":/report/images/sendToBack"));
+ connect(m_sendToBack,SIGNAL(triggered()),this,SLOT(slotSendToBack()));
+ addAction(m_sendToBack);
+
+ m_alignToLeft = new QAction(tr("Align to left"),this);
+ m_alignToLeft->setIcon(QIcon(":/report/images/alignToLeft"));
+ connect(m_alignToLeft,SIGNAL(triggered()),this,SLOT(slotAlignToLeft()));
+ addAction(m_alignToLeft);
+
+ m_alignToRight = new QAction(tr("Align to right"),this);
+ m_alignToRight->setIcon(QIcon(":/report/images/alignToRight"));
+ connect(m_alignToRight,SIGNAL(triggered()),this,SLOT(slotAlignToRight()));
+ addAction(m_alignToRight);
+
+ m_alignToVCenter = new QAction(tr("Align to vertical center"),this);
+ m_alignToVCenter->setIcon(QIcon(":/report/images/alignToVCenter"));
+ connect(m_alignToVCenter,SIGNAL(triggered()),this,SLOT(slotAlignToVCenter()));
+ addAction(m_alignToVCenter);
+
+ m_alignToTop = new QAction(tr("Align to top"),this);
+ m_alignToTop->setIcon(QIcon(":/report/images/alignToTop"));
+ connect(m_alignToTop,SIGNAL(triggered()),this,SLOT(slotAlignToTop()));
+ addAction(m_alignToTop);
+
+ m_alignToBottom = new QAction(tr("Align to bottom"),this);
+ m_alignToBottom->setIcon(QIcon(":/report/images/alignToBottom"));
+ connect(m_alignToBottom,SIGNAL(triggered()),this,SLOT(slotAlignToBottom()));
+ addAction(m_alignToBottom);
+
+ m_alignToHCenter = new QAction(tr("Align to horizontal center"),this);
+ m_alignToHCenter->setIcon(QIcon(":/report/images/alignToHCenter"));
+ connect(m_alignToHCenter,SIGNAL(triggered()),this,SLOT(slotAlignToHCenter()));
+ addAction(m_alignToHCenter);
+
+ m_sameHeight = new QAction(tr("Set same height"),this);
+ m_sameHeight->setIcon(QIcon(":/report/images/sameHeight"));
+ connect(m_sameHeight,SIGNAL(triggered()),this,SLOT(slotSameHeight()));
+ addAction(m_sameHeight);
+
+ m_sameWidth = new QAction(tr("Set same width"),this);
+ m_sameWidth->setIcon(QIcon(":/report/images/sameWidth"));
+ connect(m_sameWidth,SIGNAL(triggered()),this,SLOT(slotSameWidth()));
+ addAction(m_sameWidth);
+}
+
+} //namespace LimeReport
diff --git a/src/items/editors/lritemsaligneditorwidget.h b/src/items/editors/lritemsaligneditorwidget.h
new file mode 100644
index 0000000..3dda383
--- /dev/null
+++ b/src/items/editors/lritemsaligneditorwidget.h
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRITEMSALIGNEDITORWIDGET_H
+#define LRITEMSALIGNEDITORWIDGET_H
+
+#include "lrreportdesignwidget.h"
+#include
+#include
+
+namespace LimeReport{
+
+class ItemsAlignmentEditorWidget : public QToolBar
+{
+ Q_OBJECT
+public:
+ explicit ItemsAlignmentEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
+ explicit ItemsAlignmentEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
+ explicit ItemsAlignmentEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0);
+ explicit ItemsAlignmentEditorWidget(PageDesignIntf* page, QWidget *parent = 0);
+private slots:
+ void slotBrinToFront();
+ void slotSendToBack();
+ void slotAlignToLeft();
+ void slotAlignToRight();
+ void slotAlignToVCenter();
+ void slotAlignToTop();
+ void slotAlignToBottom();
+ void slotAlignToHCenter();
+ void slotSameHeight();
+ void slotSameWidth();
+private:
+ void initEditor();
+ ReportDesignWidget* m_reportEditor;
+ PageDesignIntf* m_page;
+
+ QAction* m_bringToFront;
+ QAction* m_sendToBack;
+ QAction* m_alignToLeft;
+ QAction* m_alignToRight;
+ QAction* m_alignToVCenter;
+ QAction* m_alignToTop;
+ QAction* m_alignToBottom;
+ QAction* m_alignToHCenter;
+ QAction* m_sameHeight;
+ QAction* m_sameWidth;
+};
+
+} //namespace LimeReport
+
+#endif // LRITEMSALIGNEDITORWIDGET_H
diff --git a/src/items/editors/lritemsborderseditorwidget.cpp b/src/items/editors/lritemsborderseditorwidget.cpp
new file mode 100644
index 0000000..4597b06
--- /dev/null
+++ b/src/items/editors/lritemsborderseditorwidget.cpp
@@ -0,0 +1,154 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lritemsborderseditorwidget.h"
+#include
+
+namespace LimeReport{
+
+ItemsBordersEditorWidget::ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, const QString& title, QWidget* parent)
+ : ItemEditorWidget(reportEditor,title,parent), m_changing(false)
+{
+ initEditor();
+}
+
+ItemsBordersEditorWidget::ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, QWidget* parent)
+ : ItemEditorWidget(reportEditor,parent), m_changing(false)
+{
+ initEditor();
+}
+
+void ItemsBordersEditorWidget::setItemEvent(BaseDesignIntf* item)
+{
+ QVariant borders=item->property("borders");
+ if (borders.isValid()){
+ updateValues((BaseDesignIntf::BorderLines)borders.toInt());
+ setEnabled(true);
+ }
+}
+
+void ItemsBordersEditorWidget::properyChangedEvent(const QString& property, const QVariant& oldValue, const QVariant& newValue)
+{
+ Q_UNUSED(oldValue)
+ if (property == "borders"){
+ m_changing = true;
+ updateValues((BaseDesignIntf::BorderLines)newValue.toInt());
+ m_changing = false;
+ }
+}
+
+void ItemsBordersEditorWidget::noBordesClicked()
+{
+ if (reportEditor())
+ reportEditor()->setBorders(0);
+ updateValues(0);
+}
+
+void ItemsBordersEditorWidget::allBordesClicked()
+{
+ int borders = BaseDesignIntf::LeftLine |
+ BaseDesignIntf::RightLine |
+ BaseDesignIntf::TopLine |
+ BaseDesignIntf::BottomLine;
+
+ updateValues((BaseDesignIntf::BorderLines)borders);
+ if (reportEditor())
+ reportEditor()->setBorders((BaseDesignIntf::BorderLines)borders);
+}
+
+void ItemsBordersEditorWidget::buttonClicked(bool)
+{
+ if (!m_changing&&reportEditor())
+ reportEditor()->setBorders(createBorders());
+}
+
+void ItemsBordersEditorWidget::initEditor()
+{
+
+ m_topLine = new QAction(tr("Top line"),this);
+ m_topLine->setIcon(QIcon(":/report/images/topLine"));
+ m_topLine->setCheckable(true);
+ connect(m_topLine,SIGNAL(toggled(bool)),this,SLOT(buttonClicked(bool)));
+ addAction(m_topLine);
+
+ m_bottomLine = new QAction(tr("Top line"),this);
+ m_bottomLine->setIcon(QIcon(":/report/images/bottomLine"));
+ m_bottomLine->setCheckable(true);
+ connect(m_bottomLine,SIGNAL(toggled(bool)),this,SLOT(buttonClicked(bool)));
+ addAction(m_bottomLine);
+
+ m_leftLine = new QAction(tr("Top line"),this);
+ m_leftLine->setIcon(QIcon(":/report/images/leftLine"));
+ m_leftLine->setCheckable(true);
+ connect(m_leftLine,SIGNAL(toggled(bool)),this,SLOT(buttonClicked(bool)));
+ addAction(m_leftLine);
+
+ m_rightLine = new QAction(tr("Top line"),this);
+ m_rightLine->setIcon(QIcon(":/report/images/rightLine"));
+ m_rightLine->setCheckable(true);
+ connect(m_rightLine,SIGNAL(toggled(bool)),this,SLOT(buttonClicked(bool)));
+ addAction(m_rightLine);
+
+ addSeparator();
+
+ m_noLines = new QAction(tr("No borders"),this);
+ m_noLines->setIcon(QIcon(":/report/images/noLines"));
+ connect(m_noLines,SIGNAL(triggered()),this,SLOT(noBordesClicked()));
+ addAction(m_noLines);
+
+ m_allLines = new QAction(tr("All borders"),this);
+ m_allLines->setIcon(QIcon(":/report/images/allLines"));
+ connect(m_allLines,SIGNAL(triggered()),this,SLOT(allBordesClicked()));
+ addAction(m_allLines);
+
+ setEnabled(false);
+
+}
+
+void ItemsBordersEditorWidget::updateValues(BaseDesignIntf::BorderLines borders)
+{
+ m_changing = true;
+ m_topLine->setChecked(borders&BaseDesignIntf::TopLine);
+ m_bottomLine->setChecked(borders&BaseDesignIntf::BottomLine);
+ m_leftLine->setChecked(borders&BaseDesignIntf::LeftLine);
+ m_rightLine->setChecked(borders&BaseDesignIntf::RightLine);
+ m_changing = false;
+}
+
+BaseDesignIntf::BorderLines ItemsBordersEditorWidget::createBorders()
+{
+ int borders = 0;
+ borders += (m_topLine->isChecked())?BaseDesignIntf::TopLine:0;
+ borders += (m_bottomLine->isChecked())?BaseDesignIntf::BottomLine:0;
+ borders += (m_leftLine->isChecked())?BaseDesignIntf::LeftLine:0;
+ borders += (m_rightLine->isChecked())?BaseDesignIntf::RightLine:0;
+ return (BaseDesignIntf::BorderLines)borders;
+}
+
+} //namespace LimeReport
diff --git a/src/items/editors/lritemsborderseditorwidget.h b/src/items/editors/lritemsborderseditorwidget.h
new file mode 100644
index 0000000..296107e
--- /dev/null
+++ b/src/items/editors/lritemsborderseditorwidget.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRITEMSBORDERSEDITORWIDGET_H
+#define LRITEMSBORDERSEDITORWIDGET_H
+
+#include
+#include "lrreportdesignwidget.h"
+#include "lritemeditorwidget.h"
+
+namespace LimeReport{
+
+class ItemsBordersEditorWidget : public ItemEditorWidget
+{
+ Q_OBJECT
+public:
+ explicit ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
+ explicit ItemsBordersEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
+private slots:
+ void noBordesClicked();
+ void allBordesClicked();
+ void buttonClicked(bool);
+protected:
+ void setItemEvent(BaseDesignIntf *item);
+ void properyChangedEvent(const QString &property, const QVariant &oldValue, const QVariant &newValue);
+private:
+ void initEditor();
+ void updateValues(BaseDesignIntf::BorderLines borders);
+ BaseDesignIntf::BorderLines createBorders();
+ QAction* m_noLines;
+ QAction* m_leftLine;
+ QAction* m_rightLine;
+ QAction* m_topLine;
+ QAction* m_bottomLine;
+ QAction* m_allLines;
+ bool m_changing;
+};
+
+}//namespace LimeReport
+
+#endif // LRITEMSBORDERSEDITORWIDGET_H
diff --git a/src/items/editors/lrtextalignmenteditorwidget.cpp b/src/items/editors/lrtextalignmenteditorwidget.cpp
new file mode 100644
index 0000000..652f678
--- /dev/null
+++ b/src/items/editors/lrtextalignmenteditorwidget.cpp
@@ -0,0 +1,190 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrtextalignmenteditorwidget.h"
+
+namespace LimeReport{
+
+TextAlignmentEditorWidget::TextAlignmentEditorWidget(ReportDesignWidget *reportEditor, const QString &title, QWidget *parent)
+ :ItemEditorWidget(reportEditor,title,parent), m_textAttibutesIsChanging(false)
+{
+ initEditor();
+}
+
+TextAlignmentEditorWidget::TextAlignmentEditorWidget(ReportDesignWidget *reportEditor, QWidget *parent)
+ :ItemEditorWidget(reportEditor,parent), m_textAttibutesIsChanging(false)
+{
+ initEditor();
+}
+
+TextAlignmentEditorWidget::TextAlignmentEditorWidget(PageDesignIntf* page, const QString& title, QWidget* parent)
+ :ItemEditorWidget(page,title,parent), m_textAttibutesIsChanging(false)
+{
+ initEditor();
+}
+
+TextAlignmentEditorWidget::TextAlignmentEditorWidget(PageDesignIntf* page, QWidget* parent)
+ :ItemEditorWidget(page,parent), m_textAttibutesIsChanging(false)
+{
+ initEditor();
+}
+
+void TextAlignmentEditorWidget::setItemEvent(BaseDesignIntf *item)
+{
+ QVariant align=item->property("alignment");
+ if (align.isValid()){
+ updateValues(Qt::Alignment(align.value()));
+ setEnabled(true);
+ }
+}
+
+void TextAlignmentEditorWidget::initEditor()
+{
+ m_textAliginLeft = new QAction(tr("Text align left"),this);
+ m_textAliginLeft->setIcon(QIcon(":/report/images/textAlignHLeft"));
+ m_textAliginLeft->setCheckable(true);
+ connect(m_textAliginLeft,SIGNAL(toggled(bool)),this,SLOT(slotTextHAttribsChanged(bool)));
+ addAction(m_textAliginLeft);
+
+ m_textAliginHCenter = new QAction(tr("Text align center"),this);
+ m_textAliginHCenter->setIcon(QIcon(":/report/images/textAlignHCenter"));
+ m_textAliginHCenter->setCheckable(true);
+ connect(m_textAliginHCenter,SIGNAL(toggled(bool)),this,SLOT(slotTextHAttribsChanged(bool)));
+ addAction(m_textAliginHCenter);
+
+ m_textAliginRight = new QAction(tr("Text align right"),this);
+ m_textAliginRight->setIcon(QIcon(":/report/images/textAlignHRight"));
+ m_textAliginRight->setCheckable(true);
+ connect(m_textAliginRight,SIGNAL(toggled(bool)),this,SLOT(slotTextHAttribsChanged(bool)));
+ addAction(m_textAliginRight);
+
+ m_textAliginJustify = new QAction(tr("Text align justify"),this);
+ m_textAliginJustify->setIcon(QIcon(":/report/images/textAlignHJustify"));
+ m_textAliginJustify->setCheckable(true);
+ connect(m_textAliginJustify,SIGNAL(toggled(bool)),this,SLOT(slotTextHAttribsChanged(bool)));
+ addAction(m_textAliginJustify);
+
+ addSeparator();
+
+ m_textAliginTop = new QAction(tr("Text align top"),this);
+ m_textAliginTop->setIcon(QIcon(":/report/images/textAlignVTop"));
+ m_textAliginTop->setCheckable(true);
+ connect(m_textAliginTop,SIGNAL(toggled(bool)),this,SLOT(slotTextVAttribsChanged(bool)));
+ addAction(m_textAliginTop);
+
+ m_textAliginVCenter = new QAction(tr("Text align center"),this);
+ m_textAliginVCenter->setIcon(QIcon(":/report/images/textAlignVCenter"));
+ m_textAliginVCenter->setCheckable(true);
+ connect(m_textAliginVCenter,SIGNAL(toggled(bool)),this,SLOT(slotTextVAttribsChanged(bool)));
+ addAction(m_textAliginVCenter);
+
+ m_textAliginBottom = new QAction(tr("Text align bottom"),this);
+ m_textAliginBottom->setIcon(QIcon(":/report/images/textAlignVBottom"));
+ m_textAliginBottom->setCheckable(true);
+ connect(m_textAliginBottom,SIGNAL(toggled(bool)),this,SLOT(slotTextVAttribsChanged(bool)));
+ addAction(m_textAliginBottom);
+
+ if (reportEditor()){
+ connect(reportEditor(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
+ this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
+ }
+ if (page()){
+ connect(page(),SIGNAL(itemPropertyChanged(QString,QString,QVariant,QVariant)),
+ this,SLOT(slotPropertyChanged(QString,QString,QVariant,QVariant)));
+ }
+ setEnabled(false);
+}
+
+void TextAlignmentEditorWidget::updateValues(const Qt::Alignment &align)
+{
+ m_textAttibutesIsChanging=true;
+ m_textAliginLeft->setChecked((align & Qt::AlignLeft)==Qt::AlignLeft);
+ m_textAliginRight->setChecked((align & Qt::AlignRight)==Qt::AlignRight);
+ m_textAliginHCenter->setChecked((align & Qt::AlignHCenter)==Qt::AlignHCenter);
+ m_textAliginJustify->setChecked((align & Qt::AlignJustify)==Qt::AlignJustify);
+ m_textAliginTop->setChecked((align & Qt::AlignTop)==Qt::AlignTop);
+ m_textAliginVCenter->setChecked((align & Qt::AlignVCenter)==Qt::AlignVCenter);
+ m_textAliginBottom->setChecked((align & Qt::AlignBottom)==Qt::AlignBottom);
+ m_textAttibutesIsChanging=false;
+}
+
+Qt::Alignment TextAlignmentEditorWidget::createAlignment()
+{
+ Qt::Alignment align = 0 ;
+ if (m_textAliginLeft->isChecked()) align |= Qt::AlignLeft;
+ if (m_textAliginHCenter->isChecked()) align |= Qt::AlignHCenter;
+ if (m_textAliginRight->isChecked()) align |= Qt::AlignRight;
+ if (m_textAliginJustify->isChecked()) align |= Qt::AlignJustify;
+ if (m_textAliginTop->isChecked()) align |= Qt::AlignTop;
+ if (m_textAliginVCenter->isChecked()) align |= Qt::AlignVCenter;
+ if (m_textAliginBottom->isChecked()) align |= Qt::AlignBottom;
+ return align;
+}
+
+void TextAlignmentEditorWidget::slotTextHAttribsChanged(bool)
+{
+ if (m_textAttibutesIsChanging) return;
+ m_textAttibutesIsChanging = true;
+
+ m_textAliginLeft->setChecked(sender()==m_textAliginLeft);
+ m_textAliginHCenter->setChecked(sender()==m_textAliginHCenter);
+ m_textAliginRight->setChecked(sender()==m_textAliginRight);
+ m_textAliginJustify->setChecked(sender()==m_textAliginJustify);
+
+ if (reportEditor()) reportEditor()->setTextAlign(createAlignment());
+ if (page()) page()->setTextAlign(createAlignment());
+ m_textAttibutesIsChanging = false;
+}
+
+void TextAlignmentEditorWidget::slotTextVAttribsChanged(bool)
+{
+ if (m_textAttibutesIsChanging) return;
+ m_textAttibutesIsChanging = true;
+
+ m_textAliginTop->setChecked(sender()==m_textAliginTop);
+ m_textAliginVCenter->setChecked(sender()==m_textAliginVCenter);
+ m_textAliginBottom->setChecked(sender()==m_textAliginBottom);
+
+ if (reportEditor()) reportEditor()->setTextAlign(createAlignment());
+ if (page()) page()->setTextAlign(createAlignment());
+ m_textAttibutesIsChanging = false;
+}
+
+void TextAlignmentEditorWidget::slotPropertyChanged(const QString &objectName, const QString &property, const QVariant &oldValue, const QVariant &newValue)
+{
+ Q_UNUSED(oldValue)
+ Q_UNUSED(newValue)
+
+ if (item()&&(item()->objectName()==objectName)&&(property=="alignment")){
+ updateValues(Qt::Alignment(item()->property("alignment").value()));
+ }
+}
+
+
+} //namespace LimeReport
diff --git a/src/items/editors/lrtextalignmenteditorwidget.h b/src/items/editors/lrtextalignmenteditorwidget.h
new file mode 100644
index 0000000..93fd39d
--- /dev/null
+++ b/src/items/editors/lrtextalignmenteditorwidget.h
@@ -0,0 +1,73 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRTEXTALIGNMENTEDITORWIDGET_H
+#define LRTEXTALIGNMENTEDITORWIDGET_H
+
+#include "lrreportdesignwidget.h"
+#include "lritemeditorwidget.h"
+#include
+#include
+
+namespace LimeReport{
+
+class TextAlignmentEditorWidget:public ItemEditorWidget
+{
+ Q_OBJECT
+public:
+ explicit TextAlignmentEditorWidget(ReportDesignWidget* reportEditor, const QString &title, QWidget *parent = 0);
+ explicit TextAlignmentEditorWidget(ReportDesignWidget* reportEditor, QWidget *parent = 0);
+ explicit TextAlignmentEditorWidget(PageDesignIntf* page, const QString &title, QWidget *parent = 0);
+ explicit TextAlignmentEditorWidget(PageDesignIntf* page, QWidget *parent = 0);
+protected:
+ void setItemEvent(BaseDesignIntf *item);
+private:
+ void initEditor();
+ void updateValues(const Qt::Alignment& align);
+ Qt::Alignment createAlignment();
+private slots:
+ void slotTextHAttribsChanged(bool);
+ void slotTextVAttribsChanged(bool);
+ void slotPropertyChanged(const QString& objectName, const QString& property, const QVariant &oldValue, const QVariant &newValue);
+private:
+ bool m_textAttibutesIsChanging;
+
+ QAction* m_textAliginLeft;
+ QAction* m_textAliginRight;
+ QAction* m_textAliginHCenter;
+ QAction* m_textAliginJustify;
+ QAction* m_textAliginTop;
+ QAction* m_textAliginBottom;
+ QAction* m_textAliginVCenter;
+
+};
+
+} //namespace LimeReport
+
+#endif // LRTEXTALIGNMENTEDITORWIDGET_H
diff --git a/src/items/images/Control-Edit Box.png b/src/items/images/Control-Edit Box.png
new file mode 100644
index 0000000..ea0fb75
Binary files /dev/null and b/src/items/images/Control-Edit Box.png differ
diff --git a/src/items/images/DataBand.png b/src/items/images/DataBand.png
new file mode 100644
index 0000000..680acb5
Binary files /dev/null and b/src/items/images/DataBand.png differ
diff --git a/src/items/images/DataBand16.png b/src/items/images/DataBand16.png
new file mode 100644
index 0000000..e608b3b
Binary files /dev/null and b/src/items/images/DataBand16.png differ
diff --git a/src/items/images/GroupFooter16.png b/src/items/images/GroupFooter16.png
new file mode 100644
index 0000000..aac7027
Binary files /dev/null and b/src/items/images/GroupFooter16.png differ
diff --git a/src/items/images/GroupHeader16.png b/src/items/images/GroupHeader16.png
new file mode 100644
index 0000000..c9a5c46
Binary files /dev/null and b/src/items/images/GroupHeader16.png differ
diff --git a/src/items/images/PageFooter.png b/src/items/images/PageFooter.png
new file mode 100644
index 0000000..847d4ec
Binary files /dev/null and b/src/items/images/PageFooter.png differ
diff --git a/src/items/images/PageFooter16.png b/src/items/images/PageFooter16.png
new file mode 100644
index 0000000..134d91c
Binary files /dev/null and b/src/items/images/PageFooter16.png differ
diff --git a/src/items/images/PageHeader.png b/src/items/images/PageHeader.png
new file mode 100644
index 0000000..afb768f
Binary files /dev/null and b/src/items/images/PageHeader.png differ
diff --git a/src/items/images/PageHeader16.png b/src/items/images/PageHeader16.png
new file mode 100644
index 0000000..6c75436
Binary files /dev/null and b/src/items/images/PageHeader16.png differ
diff --git a/src/items/images/ReportFooter.png b/src/items/images/ReportFooter.png
new file mode 100644
index 0000000..da8923f
Binary files /dev/null and b/src/items/images/ReportFooter.png differ
diff --git a/src/items/images/ReportFooter16.png b/src/items/images/ReportFooter16.png
new file mode 100644
index 0000000..33e923d
Binary files /dev/null and b/src/items/images/ReportFooter16.png differ
diff --git a/src/items/images/ReportHeader.png b/src/items/images/ReportHeader.png
new file mode 100644
index 0000000..3bbd065
Binary files /dev/null and b/src/items/images/ReportHeader.png differ
diff --git a/src/items/images/ReportHeader16.png b/src/items/images/ReportHeader16.png
new file mode 100644
index 0000000..3d38af3
Binary files /dev/null and b/src/items/images/ReportHeader16.png differ
diff --git a/src/items/images/ReportPage.png b/src/items/images/ReportPage.png
new file mode 100644
index 0000000..4aaf803
Binary files /dev/null and b/src/items/images/ReportPage.png differ
diff --git a/src/items/images/ReportPage16.png b/src/items/images/ReportPage16.png
new file mode 100644
index 0000000..e9b46b2
Binary files /dev/null and b/src/items/images/ReportPage16.png differ
diff --git a/src/items/images/SubDetailBand16.png b/src/items/images/SubDetailBand16.png
new file mode 100644
index 0000000..64cbe2f
Binary files /dev/null and b/src/items/images/SubDetailBand16.png differ
diff --git a/src/items/images/SubDetailFooterBand16.png b/src/items/images/SubDetailFooterBand16.png
new file mode 100644
index 0000000..3504ea3
Binary files /dev/null and b/src/items/images/SubDetailFooterBand16.png differ
diff --git a/src/items/images/SubDetailHeaderBand16.png b/src/items/images/SubDetailHeaderBand16.png
new file mode 100644
index 0000000..7d1c0b9
Binary files /dev/null and b/src/items/images/SubDetailHeaderBand16.png differ
diff --git a/src/items/images/addBand1.png b/src/items/images/addBand1.png
new file mode 100644
index 0000000..b2941ff
Binary files /dev/null and b/src/items/images/addBand1.png differ
diff --git a/src/items/images/barcode2.png b/src/items/images/barcode2.png
new file mode 100644
index 0000000..328a2ac
Binary files /dev/null and b/src/items/images/barcode2.png differ
diff --git a/src/items/images/hlayout.png b/src/items/images/hlayout.png
new file mode 100644
index 0000000..3c9523e
Binary files /dev/null and b/src/items/images/hlayout.png differ
diff --git a/src/items/images/hlayuot_3_24.png b/src/items/images/hlayuot_3_24.png
new file mode 100644
index 0000000..66cf271
Binary files /dev/null and b/src/items/images/hlayuot_3_24.png differ
diff --git a/src/items/images/imageItem.png b/src/items/images/imageItem.png
new file mode 100644
index 0000000..8705346
Binary files /dev/null and b/src/items/images/imageItem.png differ
diff --git a/src/items/images/imageItem1.png b/src/items/images/imageItem1.png
new file mode 100644
index 0000000..4685622
Binary files /dev/null and b/src/items/images/imageItem1.png differ
diff --git a/src/items/images/imageItem2.png b/src/items/images/imageItem2.png
new file mode 100644
index 0000000..02cda78
Binary files /dev/null and b/src/items/images/imageItem2.png differ
diff --git a/src/items/images/insert-text.png b/src/items/images/insert-text.png
new file mode 100644
index 0000000..8cdff85
Binary files /dev/null and b/src/items/images/insert-text.png differ
diff --git a/src/items/images/insert-text_1.png b/src/items/images/insert-text_1.png
new file mode 100644
index 0000000..86741ea
Binary files /dev/null and b/src/items/images/insert-text_1.png differ
diff --git a/src/items/images/insert-text_2.png b/src/items/images/insert-text_2.png
new file mode 100644
index 0000000..c1a6403
Binary files /dev/null and b/src/items/images/insert-text_2.png differ
diff --git a/src/items/images/insert-text_3.png b/src/items/images/insert-text_3.png
new file mode 100644
index 0000000..f278dd4
Binary files /dev/null and b/src/items/images/insert-text_3.png differ
diff --git a/src/items/images/insert-text_5.png b/src/items/images/insert-text_5.png
new file mode 100644
index 0000000..e745fbd
Binary files /dev/null and b/src/items/images/insert-text_5.png differ
diff --git a/src/items/images/settings.png b/src/items/images/settings.png
new file mode 100644
index 0000000..9003698
Binary files /dev/null and b/src/items/images/settings.png differ
diff --git a/src/items/images/settings2.png b/src/items/images/settings2.png
new file mode 100644
index 0000000..8c53fe4
Binary files /dev/null and b/src/items/images/settings2.png differ
diff --git a/src/items/images/shape2.png b/src/items/images/shape2.png
new file mode 100644
index 0000000..c2bf427
Binary files /dev/null and b/src/items/images/shape2.png differ
diff --git a/src/items/images/shape4.png b/src/items/images/shape4.png
new file mode 100644
index 0000000..cc74953
Binary files /dev/null and b/src/items/images/shape4.png differ
diff --git a/src/items/images/shape5.png b/src/items/images/shape5.png
new file mode 100644
index 0000000..8454cbe
Binary files /dev/null and b/src/items/images/shape5.png differ
diff --git a/src/items/items.qrc b/src/items/items.qrc
new file mode 100644
index 0000000..86b8d74
--- /dev/null
+++ b/src/items/items.qrc
@@ -0,0 +1,37 @@
+
+
+ images/insert-text.png
+ images/barcode2.png
+ images/imageItem.png
+ images/shape2.png
+ images/shape4.png
+ images/insert-text_2.png
+ images/insert-text_3.png
+ images/hlayout.png
+ images/insert-text_5.png
+ images/shape5.png
+ images/imageItem1.png
+ images/imageItem2.png
+ images/settings.png
+ images/settings2.png
+ images/hlayuot_3_24.png
+ images/addBand1.png
+ images/DataBand.png
+ images/PageHeader.png
+ images/PageFooter.png
+ images/ReportHeader.png
+ images/ReportFooter.png
+ images/ReportPage.png
+ images/PageFooter16.png
+ images/PageHeader16.png
+ images/ReportFooter16.png
+ images/ReportHeader16.png
+ images/SubDetailBand16.png
+ images/SubDetailFooterBand16.png
+ images/SubDetailHeaderBand16.png
+ images/DataBand16.png
+ images/GroupFooter16.png
+ images/GroupHeader16.png
+ images/ReportPage16.png
+
+
diff --git a/src/items/lralignpropitem.cpp b/src/items/lralignpropitem.cpp
new file mode 100644
index 0000000..b859d1d
--- /dev/null
+++ b/src/items/lralignpropitem.cpp
@@ -0,0 +1,165 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lralignpropitem.h"
+#include "objectinspector/propertyItems/lrenumpropitem.h"
+#include "objectinspector/editors/lrcomboboxeditor.h"
+#include "lrtextitem.h"
+
+namespace{
+ LimeReport::ObjectPropItem * createAlignItem(
+ QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly
+ ){
+ return new LimeReport::AlignmentPropItem(object, objects, name, displayName, data, parent, readonly);
+ }
+
+ bool registred = LimeReport::ObjectPropFactory::instance().registerCreator(
+ LimeReport::APropIdent("alignment","LimeReport::TextItem"),
+ QObject::tr("alignment"),
+ createAlignItem
+ );
+}
+
+namespace LimeReport{
+
+QString AlignmentPropItem::associateValue(int value, const AlignMap* map) const
+{
+ QString result;
+ QMap::const_iterator it = map->constBegin();
+ for(;it!= map->constEnd();++it){
+ if ((value & it.value())) {
+ if (result.isEmpty()) result+=it.key();
+ else result=result+" | "+it.key();
+ }
+ }
+ return result;
+}
+
+AlignmentPropItem::AlignmentPropItem(QObject *object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem *parent, bool readonly)
+ :ObjectPropItem(object, objects, name,displayName,value,parent,readonly)
+{
+
+ m_horizMap.insert(tr("Left"),Qt::AlignLeft);
+ m_horizMap.insert(tr("Right"),Qt::AlignRight);
+ m_horizMap.insert(tr("Center"),Qt::AlignHCenter);
+ m_horizMap.insert(tr("Justify"),Qt::AlignJustify);
+
+ m_vertMap.insert(tr("Top"),Qt::AlignTop);
+ m_vertMap.insert(tr("Center"),Qt::AlignVCenter);
+ m_vertMap.insert(tr("Botom"),Qt::AlignBottom);
+
+ m_horizEditor = new AlignmentItemEditor(object, objects, name,tr("horizontal"),value.toInt(),this,false,m_horizMap);
+ m_vertEditor = new AlignmentItemEditor(object, objects, name,tr("vertical"), value.toInt(),this,false,m_vertMap);
+
+ this->appendItem(m_horizEditor);
+ this->appendItem(m_vertEditor);
+}
+
+QString AlignmentPropItem::displayValue() const
+{
+ return associateValue(propertyValue().toInt(),&m_horizMap)+" | "+
+ associateValue(propertyValue().toInt(),&m_vertMap);
+}
+
+void AlignmentPropItem::setPropertyValue(QVariant value)
+{
+ m_horizEditor->setPropertyValue(value);
+ m_vertEditor->setPropertyValue(value);
+ ObjectPropItem::setPropertyValue(value);
+}
+
+AlignmentItemEditor::AlignmentItemEditor(QObject *object, ObjectsList* objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem *parent,
+ bool readonly, AlignMap acceptableValues)
+ :ObjectPropItem(object, objects, name, displayName, value, parent, readonly),m_acceptableValues(acceptableValues)
+{
+ if (! extractAcceptableValue(value.toInt()).isEmpty())
+ setPropertyValue(extractAcceptableValue(value.toInt())[0]);
+ else setPropertyValue(0);
+}
+
+void AlignmentItemEditor::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
+{
+ int flags = object()->property(propertyName().toLatin1()).toInt();
+ int align = m_acceptableValues.value(qobject_cast(propertyEditor)->text());
+ flags=clearAcceptableValues(flags) | align;
+ object()->setProperty(propertyName().toLatin1(),flags);
+ foreach(QObject* item,*objects()){item->setProperty(propertyName().toLatin1(),flags);}
+ parent()->setPropertyValue(flags);
+ model->setData(index,align);
+}
+
+QVector AlignmentItemEditor::extractAcceptableValue(int flags)
+{
+ QVector result;
+ AlignMap::const_iterator it = m_acceptableValues.constBegin();
+ for (;it != m_acceptableValues.constEnd();++it)
+ {
+ if (flags & it.value()) result<addItems(enumValues);
+ return editor;
+}
+
+void AlignmentItemEditor::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
+{
+ ComboBoxEditor *editor=qobject_cast(propertyEditor);
+ editor->setTextValue(m_acceptableValues.key(Qt::Alignment(propertyValue().toInt())));
+}
+
+QString AlignmentItemEditor::displayValue() const
+{
+ return m_acceptableValues.key(Qt::Alignment(propertyValue().toInt()));
+}
+
+void AlignmentItemEditor::setPropertyValue(QVariant value)
+{
+ ObjectPropItem::setPropertyValue(extractAcceptableValue(value.toInt())[0]);
+}
+
+}
diff --git a/src/items/lralignpropitem.h b/src/items/lralignpropitem.h
new file mode 100644
index 0000000..36a0bd7
--- /dev/null
+++ b/src/items/lralignpropitem.h
@@ -0,0 +1,80 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRALIGNPROPITEM_H
+#define LRALIGNPROPITEM_H
+
+#include "lrobjectpropitem.h"
+#include "objectinspector/propertyItems/lrenumpropitem.h"
+
+namespace LimeReport{
+
+typedef QMap AlignMap;
+
+class AlignmentItemEditor;
+
+class AlignmentPropItem : public ObjectPropItem
+{
+ Q_OBJECT
+public:
+ AlignmentPropItem():ObjectPropItem(){}
+ AlignmentPropItem(QObject *object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly=true);
+ QString displayValue() const;
+ void setPropertyValue(QVariant value);
+private:
+ AlignMap m_vertMap;
+ AlignMap m_horizMap;
+ AlignmentItemEditor* m_horizEditor;
+ AlignmentItemEditor* m_vertEditor;
+ QString associateValue(int value, const AlignMap *map) const;
+};
+
+class AlignmentItemEditor : public ObjectPropItem
+{
+ Q_OBJECT
+public:
+ AlignmentItemEditor():ObjectPropItem(){}
+ AlignmentItemEditor(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly,
+ AlignMap acceptableValues);
+ void setModelData(QWidget * propertyEditor, QAbstractItemModel * model, const QModelIndex & index);
+ void setPropertyEditorData(QWidget * propertyEditor, const QModelIndex &) const;
+ QWidget* createProperyEditor(QWidget *parent) const;
+ QString displayValue() const;
+ void setPropertyValue(QVariant value);
+protected:
+ QVector extractAcceptableValue(int flags);
+ int clearAcceptableValues(int flags);
+ AlignMap acceptableValues() const {return m_acceptableValues;}
+private:
+ AlignMap m_acceptableValues;
+};
+
+
+}
+#endif // LRALIGNPROPITEM_H
diff --git a/src/items/lrbarcodeitem.cpp b/src/items/lrbarcodeitem.cpp
new file mode 100644
index 0000000..5647c21
--- /dev/null
+++ b/src/items/lrbarcodeitem.cpp
@@ -0,0 +1,248 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrbarcodeitem.h"
+#include "lrdesignelementsfactory.h"
+#include "qzint.h"
+#include "lrglobal.h"
+
+namespace{
+
+const QString xmlTag = "BarcodeItem";
+
+LimeReport::BaseDesignIntf * createBarcodeItem(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::BarcodeItem(owner,parent);
+}
+bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(xmlTag, LimeReport::ItemAttribs(QObject::tr("Barcode Item"),"Item"), createBarcodeItem);
+
+}
+
+namespace LimeReport{
+
+BarcodeItem::BarcodeItem(QObject* owner,QGraphicsItem* parent)
+ : ContentItemDesignIntf(xmlTag,owner,parent),m_designTestValue("1"), m_barcodeType(CODE128),
+ m_foregroundColor(Qt::black), m_backgroundColor(Qt::white), m_whitespace(10), m_angle(Angle0),
+ m_barcodeWidth(0), m_securityLevel(0), m_pdf417CodeWords(928)
+{}
+
+BarcodeItem::~BarcodeItem()
+{}
+
+BaseDesignIntf *BarcodeItem::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new BarcodeItem(owner,parent);
+}
+
+void BarcodeItem::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ ppainter->save();
+ Zint::QZint bc;
+ if (itemMode() & DesignMode) bc.setText(m_designTestValue);
+ else bc.setText(m_content);
+ bc.setSymbol(m_barcodeType);
+ bc.setWhitespace(m_whitespace);
+ bc.setFgColor(m_foregroundColor);
+ bc.setBgColor(m_backgroundColor);
+ bc.setWidth(m_barcodeWidth);
+ bc.setSecurityLevel(m_securityLevel);
+ bc.setPdf417CodeWords(m_pdf417CodeWords);
+
+ if (isSelected()) ppainter->setOpacity(SELECTION_OPACITY);
+
+ QRectF bcRect;
+
+ switch (m_angle) {
+ case Angle0:
+ bcRect = rect();
+ break;
+ case Angle90:
+ ppainter->translate(width(),0);
+ ppainter->rotate(90);
+ bcRect = QRectF(0,0,height(),width());
+ break;
+ case Angle180:
+ bcRect = rect();
+ ppainter->translate(width(),height());
+ ppainter->rotate(180);
+ break;
+ case Angle270:
+ ppainter->translate(0,height());
+ ppainter->rotate(270);
+ bcRect = QRectF(0,0,height(),width());
+ break;
+ }
+
+ bc.render(*ppainter,bcRect,Zint::QZint::KeepAspectRatio);
+ ppainter->restore();
+ ItemDesignIntf::paint(ppainter,option,widget);
+}
+
+void BarcodeItem::setContent(const QString &content)
+{
+ if (m_content!=content){
+ QString oldValue = m_content;
+ m_content=content;
+ update();
+ notify("content",oldValue,m_content);
+ }
+}
+
+void BarcodeItem::setBarcodeType(BarcodeItem::BarcodeType value)
+{
+ if (m_barcodeType!=value){
+ BarcodeType oldValue = m_barcodeType;
+ m_barcodeType = value;
+ update();
+ notify("barcodeType",oldValue,value);
+ }
+}
+
+void BarcodeItem::setDesignTestValue(QString value)
+{
+ if (m_designTestValue!=value){
+ QString oldValue = m_designTestValue;
+ m_designTestValue=value;
+ update();
+ notify("testValue",oldValue,value);
+ }
+}
+
+void BarcodeItem::setForegroundColor(QColor value)
+{
+ if (m_foregroundColor != value){
+ QColor oldValue = m_foregroundColor;
+ m_foregroundColor=value;
+ update();
+ notify("foregroundColor",oldValue,value);
+ }
+}
+
+void BarcodeItem::setBackgroundColor(QColor value)
+{
+ if (m_backgroundColor != value){
+ QColor oldValue = m_backgroundColor;
+ m_backgroundColor=value;
+ update();
+ notify("backgroundColor",oldValue,value);
+ }
+}
+
+void BarcodeItem::setWhitespace(int value)
+{
+ if (m_whitespace != value){
+ int oldValue = m_whitespace;
+ m_whitespace = value;
+ update();
+ notify("whitespace",oldValue,value);
+ }
+}
+
+BarcodeItem::AngleType BarcodeItem::angle() const
+{
+ return m_angle;
+}
+
+void BarcodeItem::setAngle(const AngleType &angle)
+{
+ if (m_angle!=angle){
+ AngleType oldValue = m_angle;
+ m_angle = angle;
+ if (!isLoading()){
+ update();
+ notify("angle",oldValue,angle);
+ }
+ }
+}
+
+int BarcodeItem::barcodeWidth() const
+{
+ return m_barcodeWidth;
+}
+
+void BarcodeItem::setBarcodeWidth(int barcodeWidth)
+{
+ if (m_barcodeWidth != barcodeWidth){
+ int oldValue = m_barcodeWidth;
+ m_barcodeWidth = barcodeWidth;
+ if (!isLoading()){
+ update();
+ notify("barcodeWidth",oldValue,m_barcodeWidth);
+ }
+ }
+}
+
+int BarcodeItem::securityLevel() const
+{
+ return m_securityLevel;
+}
+
+void BarcodeItem::setSecurityLevel(int securityLevel)
+{
+ if (m_securityLevel != securityLevel){
+ int oldValue = m_securityLevel;
+ m_securityLevel = securityLevel;
+ if (!isLoading()){
+ update();
+ notify("securityLevel",oldValue,m_securityLevel);
+ }
+ }
+}
+
+int BarcodeItem::pdf417CodeWords() const
+{
+ return m_pdf417CodeWords;
+}
+
+void BarcodeItem::setPdf417CodeWords(int pdf417CodeWords)
+{
+ if (m_pdf417CodeWords != pdf417CodeWords){
+ int oldValue = m_pdf417CodeWords;
+ m_pdf417CodeWords = pdf417CodeWords;
+ if (!isLoading()){
+ update();
+ notify("pdf417CodeWords",oldValue,m_pdf417CodeWords);
+ }
+ }
+}
+
+void BarcodeItem::updateItemSize(RenderPass pass, int)
+{
+ switch(pass){
+ case FirstPass:
+ setContent(expandUserVariables(content(),pass,NoEscapeSymbols));
+ setContent(expandDataFields(content(),NoEscapeSymbols));
+ break;
+ default:;
+ }
+}
+
+bool BarcodeItem::isNeedUpdateSize(RenderPass pass) const
+{return (pass==FirstPass)?true:false;}
+
+}
diff --git a/src/items/lrbarcodeitem.h b/src/items/lrbarcodeitem.h
new file mode 100644
index 0000000..001aec0
--- /dev/null
+++ b/src/items/lrbarcodeitem.h
@@ -0,0 +1,173 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRBARCODEITEM_H
+#define LRBARCODEITEM_H
+#include "lritemdesignintf.h"
+#include
+
+namespace LimeReport{
+
+class BarcodeItem : public LimeReport::ContentItemDesignIntf {
+ Q_OBJECT
+ Q_ENUMS(BarcodeType)
+ Q_ENUMS(AngleType)
+ Q_PROPERTY(QString content READ content WRITE setContent)
+ Q_PROPERTY(BarcodeType barcodeType READ barcodeType WRITE setBarcodeType )
+ Q_PROPERTY(QString testValue READ designTestValue WRITE setDesignTestValue)
+ Q_PROPERTY(QColor foregroundColor READ foregroundColor WRITE setForegroundColor)
+ Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
+ Q_PROPERTY(int whitespace READ whitespace WRITE setWhitespace)
+ Q_PROPERTY(AngleType angle READ angle WRITE setAngle)
+ Q_PROPERTY(int barcodeWidth READ barcodeWidth WRITE setBarcodeWidth)
+ Q_PROPERTY(int securityLevel READ securityLevel WRITE setSecurityLevel)
+ Q_PROPERTY(int pdf417CodeWords READ pdf417CodeWords WRITE setPdf417CodeWords)
+public:
+// enum BarcodeType {QRCODE=58,CODE128=20,DATAMATRIX=71,MAXICODE=57,MICROPDF417=84};
+// enum BarcodeType {CODE_11=1,C25MATRIX=2,QRCODE=58,CODE128=20,DATAMATRIX=71,MAXICODE=57,MICROPDF417=84,
+// EAN=13,PDF417=55, TELEPEN_NUM=87,ITF14=89, KIX=90, MICROQR=97,
+// EAN14=72,CHANNEL=140,CODEONE=141,GRIDMATRIX=142};
+ enum BarcodeType {
+ CODE11 =1,
+ C25MATRIX =2,
+ C25INTER =3,
+ C25IATA =4,
+ C25LOGIC =6,
+ C25IND =7,
+ CODE39 =8,
+ EXCODE39 =9,
+ EANX =13,
+ EAN128 =16,
+ CODABAR =18,
+ CODE128 =20,
+ DPLEIT =21,
+ DPIDENT =22,
+ CODE16K =23,
+ CODE93 =25,
+ FLAT =28,
+ RSS14 =29,
+ RSS_LTD =30,
+ RSS_EXP =31,
+ TELEPEN =32,
+ UPCA =34,
+ UPCE =37,
+ POSTNET =40,
+ MSI_PLESSEY =47,
+ FIM =49,
+ LOGMARS =50,
+ PHARMA =51,
+ PZN =52,
+ PHARMA_TWO =53,
+ PDF417 =55,
+ PDF417TRUNC =56,
+ MAXICODE =57,
+ QRCODE =58,
+ CODE128B =60,
+ AUSPOST =63,
+ AUSREPLY =66,
+ AUSROUTE =67,
+ AUSREDIRECT =68,
+ ISBNX =69,
+ RM4SCC =70,
+ DATAMATRIX =71,
+ ITF14 =72,
+ CODABLOCKF =74,
+ NVE18 =75,
+ KOREAPOST =77,
+ RSS14STACK =79,
+ RSS14STACK_OMNI =80,
+ RSS_EXPSTACK =81,
+ PLANET =82,
+ MICROPDF417 =84,
+ ONECODE =85,
+ PLESSEY =86,
+ KIX =90,
+ AZTEC =92,
+ DAFT =93,
+ ITALYPOST =94,
+ DPD =96,
+ MICROQR =97,
+ TELEPEN_NUM =128,
+ CODE32 =129,
+ EANX_CC =130,
+ EAN128_CC =131,
+ RSS14_CC =132,
+ RSS_LTD_CC =133,
+ RSS_EXP_CC =134,
+ UPCA_CC =135,
+ UPCE_CC =136,
+ RSS14STACK_CC =137,
+ RSS14_OMNI_CC =138,
+ RSS_EXPSTACK_CC =139
+
+ };
+ enum AngleType{Angle0,Angle90,Angle180,Angle270};
+ BarcodeItem(QObject *owner, QGraphicsItem *parent);
+ ~BarcodeItem();
+ virtual BaseDesignIntf* createSameTypeItem(QObject *owner, QGraphicsItem *parent);
+ virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ virtual void updateItemSize(RenderPass pass, int);
+ virtual bool isNeedUpdateSize(RenderPass pass) const;
+ void setContent(const QString& content);
+ QString content() const {return m_content;}
+ void setBarcodeType(BarcodeType value);
+ BarcodeType barcodeType(){return m_barcodeType;}
+ void setDesignTestValue(QString value);
+ QString designTestValue(){return m_designTestValue;}
+ QColor foregroundColor(){return m_foregroundColor;}
+ void setForegroundColor(QColor value);
+ QColor backgroundColor(){return m_backgroundColor;}
+ void setBackgroundColor(QColor value);
+ int whitespace(){return m_whitespace;}
+ void setWhitespace(int value);
+ AngleType angle() const;
+ void setAngle(const AngleType &angle);
+ int barcodeWidth() const;
+ void setBarcodeWidth(int barcodeWidth);
+ int securityLevel() const;
+ void setSecurityLevel(int securityLevel);
+ int pdf417CodeWords() const;
+ void setPdf417CodeWords(int pdf417CodeWords);
+
+private:
+ Zint::QZint m_bc;
+ QString m_content;
+ QString m_designTestValue;
+ BarcodeType m_barcodeType;
+ QColor m_foregroundColor;
+ QColor m_backgroundColor;
+ int m_whitespace;
+ AngleType m_angle;
+ int m_barcodeWidth;
+ int m_securityLevel;
+ int m_pdf417CodeWords;
+};
+
+}
+#endif // LRBARCODEITEM_H
diff --git a/src/items/lrhorizontallayout.cpp b/src/items/lrhorizontallayout.cpp
new file mode 100644
index 0000000..340b10b
--- /dev/null
+++ b/src/items/lrhorizontallayout.cpp
@@ -0,0 +1,432 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrhorizontallayout.h"
+#include "lrdesignelementsfactory.h"
+
+#include
+#include
+#include
+#include
+
+#include "lrbasedesignintf.h"
+
+const QString xmlTag = "HLayout";
+
+namespace {
+
+LimeReport::BaseDesignIntf *createHLayout(QObject *owner, LimeReport::BaseDesignIntf *parent)
+{
+ return new LimeReport::HorizontalLayout(owner, parent);
+}
+bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTag,
+ LimeReport::ItemAttribs(QObject::tr("HLayout"), LimeReport::bandTAG),
+ createHLayout
+ );
+}
+
+
+namespace LimeReport {
+
+bool lessThen(BaseDesignIntf *c1, BaseDesignIntf* c2){
+ return c1->pos().x()pos().x();
+}
+
+
+HorizontalLayout::HorizontalLayout(QObject *owner, QGraphicsItem *parent)
+ : LayoutDesignIntf(xmlTag, owner, parent),m_isRelocating(false)
+{
+ setPosibleResizeDirectionFlags(ResizeBottom);
+ m_layoutMarker = new LayoutMarker(this);
+ m_layoutMarker->setParentItem(this);
+ m_layoutMarker->setColor(Qt::red);
+ m_layoutMarker->setHeight(height());
+ m_layoutMarker->setZValue(1);
+}
+
+HorizontalLayout::~HorizontalLayout()
+{
+ if (m_layoutMarker) {
+ delete m_layoutMarker; m_layoutMarker=0;
+ }
+}
+
+BaseDesignIntf *HorizontalLayout::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new LimeReport::HorizontalLayout(owner, parent);
+}
+
+void HorizontalLayout::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
+{
+ Q_UNUSED(event)
+// if ((itemMode() & LayoutEditMode) || isSelected()){
+// setChildVisibility(false);
+// }
+}
+
+void HorizontalLayout::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+{
+ Q_UNUSED(event)
+// setChildVisibility(true);
+}
+
+void HorizontalLayout::geometryChangedEvent(QRectF newRect, QRectF )
+{
+ m_layoutMarker->setHeight(newRect.height());
+ relocateChildren();
+}
+
+void HorizontalLayout::setChildVisibility(bool value){
+ foreach(QGraphicsItem* child,childItems()){
+ BaseDesignIntf* item = dynamic_cast(child);
+ if(item)
+ item->setVisible(value);
+ }
+}
+
+int HorizontalLayout::childrenCount()
+{
+ return m_children.size();
+}
+
+void HorizontalLayout::initMode(BaseDesignIntf::ItemMode mode)
+{
+ BaseDesignIntf::initMode(mode);
+ if ((mode==PreviewMode)||(mode==PrintMode)){
+ m_layoutMarker->setVisible(false);
+ } else {
+ m_layoutMarker->setVisible(true);
+ }
+}
+
+bool HorizontalLayout::canBeSplitted(int height) const
+{
+ foreach(QGraphicsItem* qgItem,childItems()){
+ BaseDesignIntf* item=dynamic_cast(qgItem);
+ if (item)
+ if (!item->canBeSplitted(height-item->pos().y())) return false;
+ }
+ return true;
+}
+
+BaseDesignIntf *HorizontalLayout::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
+{
+ HorizontalLayout* upperPart = dynamic_cast(createSameTypeItem(owner,parent));
+ upperPart->initFromItem(this);
+ qreal maxHeight = 0;
+ foreach(BaseDesignIntf* item,childBaseItems()){
+
+ if ((item->geometry().top()geometry().bottom()>height)){
+ int sliceHeight = height-item->geometry().top();
+ if (item->canBeSplitted(sliceHeight)){
+ BaseDesignIntf* slicedPart = item->cloneUpperPart(sliceHeight,upperPart,upperPart);
+ if (maxHeightheight()) maxHeight = slicedPart->height();
+ } else {
+ item->cloneEmpty(sliceHeight,upperPart,upperPart);
+ item->setPos(item->pos().x(),item->pos().y()+((height+1)-item->geometry().top()));
+ }
+ }
+ }
+
+ foreach(BaseDesignIntf* item, upperPart->childBaseItems()){
+ item->setHeight((maxHeightsetHeight(height);
+
+ return upperPart;
+}
+
+BaseDesignIntf *HorizontalLayout::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent)
+{
+ qreal maxHeight = 0;
+ HorizontalLayout* bottomPart = dynamic_cast(createSameTypeItem(owner,parent));
+ bottomPart->initFromItem(this);
+ foreach(BaseDesignIntf* item,childBaseItems()){
+ if ((item->geometry().top()geometry().bottom()>height)){
+ BaseDesignIntf* tmpItem=item->cloneBottomPart(height,bottomPart,bottomPart);
+ tmpItem->setPos(tmpItem->pos().x(),0);
+ if (maxHeightheight())
+ maxHeight = tmpItem->height();
+ }
+ }
+
+ if (!bottomPart->isEmpty()){
+ foreach (BaseDesignIntf* item, bottomPart->childBaseItems()) {
+ item->setHeight(maxHeight);
+ }
+ bottomPart->setHeight(maxHeight);
+ }
+ return bottomPart;
+}
+
+void HorizontalLayout::restoreChild(BaseDesignIntf* item){
+ if (m_children.contains(item)) return;
+
+ m_isRelocating=true;
+ foreach (BaseDesignIntf* child, childBaseItems()) {
+ if (child->pos()==item->pos()){
+ int index = m_children.indexOf(child)-1;
+ m_children.insert(index,item);
+ child->setPos(item->pos().x()+item->width(),0);
+ break;
+ }
+ }
+
+ connect(item,SIGNAL(destroyed(QObject*)),this,SLOT(slotOnChildDestroy(QObject*)));
+ connect(item,SIGNAL(geometryChanged(QObject*,QRectF,QRectF)),this,SLOT(slotOnChildGeometryChanged(QObject*,QRectF,QRectF)));
+ item->setFixedPos(true);
+ item->setPosibleResizeDirectionFlags(ResizeRight | ResizeBottom);
+ item->setParent(this);
+ item->setParentItem(this);
+
+ updateLayoutSize();
+ m_isRelocating=false;
+}
+
+bool HorizontalLayout::isEmpty() const
+{
+ bool isEmpty = true;
+ bool allItemsIsText = true;
+ foreach (QGraphicsItem* qgItem, childItems()) {
+ ContentItemDesignIntf* item = dynamic_cast(qgItem);
+ if (item && !item->content().isEmpty()) isEmpty = false;
+ if (!item && dynamic_cast(qgItem))
+ allItemsIsText = false;
+ }
+ return (isEmpty && allItemsIsText);
+}
+
+void HorizontalLayout::addChild(BaseDesignIntf *item, bool updateSize)
+{
+ if (m_children.count() > 0)
+ item->setPos(m_children.last()->pos().x() + m_children.last()->width(), 0);
+ else
+ item->setPos(0, 0);
+
+ m_children.append(item);
+ item->setParentItem(this);
+ item->setParent(this);
+ item->setFixedPos(true);
+ item->setPosibleResizeDirectionFlags(ResizeRight | ResizeBottom);
+
+ connect(item,SIGNAL(destroyed(QObject*)),this,SLOT(slotOnChildDestroy(QObject*)));
+ connect(item,SIGNAL(geometryChanged(QObject*,QRectF,QRectF)),this,SLOT(slotOnChildGeometryChanged(QObject*,QRectF,QRectF)));
+
+ if (updateSize){
+ relocateChildren();
+ updateLayoutSize();
+ }
+}
+
+void HorizontalLayout::collectionLoadFinished(const QString &collectionName)
+{
+ ItemDesignIntf::collectionLoadFinished(collectionName);
+ if (collectionName.compare("children",Qt::CaseInsensitive)==0){
+#ifdef HAVE_QT5
+ foreach(QObject* obj,children()){
+#else
+ foreach(QObject* obj,QObject::children()){
+#endif
+ BaseDesignIntf* item = dynamic_cast(obj);
+ if (item) {
+ addChild(item,false);
+ }
+ }
+ }
+}
+
+void HorizontalLayout::objectLoadFinished()
+{
+ m_layoutMarker->setHeight(height());
+ LayoutDesignIntf::objectLoadFinished();
+}
+
+void HorizontalLayout::updateLayoutSize()
+{
+ int w = 0;
+ qreal h = 0;
+ foreach(BaseDesignIntf* item, m_children){
+ if (hheight()) h=item->height();
+ w+=item->width();
+ }
+ if (h>0) setHeight(h);
+ setWidth(w);
+}
+
+void HorizontalLayout::relocateChildren()
+{
+ if (m_children.count()setPos(curX,0);
+ curX+=item->width();
+ item->setHeight(height());
+ }
+ m_isRelocating = false;
+}
+
+void HorizontalLayout::beforeDelete()
+{
+ m_children.clear();
+#ifdef HAVE_QT5
+ foreach (QObject *item, children()) {
+#else
+ foreach (QObject *item, QObject::children()) {
+#endif
+ BaseDesignIntf *bdItem = dynamic_cast(item);
+ if (bdItem) {
+ bdItem->setParentItem(parentItem());
+ bdItem->setParent(parent());
+ bdItem->setVisible(true);
+ bdItem->setPos(mapToParent(bdItem->pos()));
+ bdItem->setFixedPos(false);
+ bdItem->setPosibleResizeDirectionFlags(AllDirections);
+ }
+ }
+}
+
+void HorizontalLayout::updateItemSize(RenderPass pass, int maxHeight)
+{
+ m_isRelocating=true;
+ ItemDesignIntf::updateItemSize(pass,maxHeight);
+ foreach(QGraphicsItem *child, childItems()){
+ BaseDesignIntf* item = dynamic_cast(child);
+ if (item) item->updateItemSize(pass,maxHeight);
+ }
+ updateLayoutSize();
+ relocateChildren();
+ m_isRelocating=false;
+}
+
+bool HorizontalLayout::isNeedUpdateSize(RenderPass pass) const
+{
+ foreach (QGraphicsItem *child, childItems()) {
+ BaseDesignIntf* item = dynamic_cast(child);
+ if (item && item->isNeedUpdateSize(pass))
+ return true;
+ }
+ return false;
+}
+
+void HorizontalLayout::childAddedEvent(BaseDesignIntf *child)
+{
+ addChild(child,false);
+}
+
+void HorizontalLayout::slotOnChildDestroy(QObject* child)
+{
+ m_children.removeAll(static_cast(child));
+ if (m_children.count()<2){
+ beforeDelete();
+// deleteLater();
+ } else {
+ relocateChildren();
+ updateLayoutSize();
+ }
+}
+
+void HorizontalLayout::slotOnChildGeometryChanged(QObject *, QRectF newGeometry, QRectF)
+{
+ if (!m_isRelocating){
+ setHeight(newGeometry.height());
+ relocateChildren();
+ updateLayoutSize();
+ }
+}
+
+LayoutMarker::LayoutMarker(HorizontalLayout *layout, QGraphicsItem *parent)
+ :QGraphicsItem(parent), m_rect(0,0,30,30), m_color(Qt::red), m_layout(layout){
+ setFlag(QGraphicsItem::ItemIsMovable);
+}
+
+void LayoutMarker::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ painter->save();
+ painter->setOpacity(LAYOUT_MARKER_OPACITY);
+ painter->fillRect(boundingRect(),m_color);
+
+ painter->setRenderHint(QPainter::Antialiasing);
+ qreal size = (boundingRect().width()isSelected()){
+ painter->setOpacity(1);
+ QRectF r = QRectF(0,0,size,size);
+ painter->setBrush(Qt::white);
+ painter->setPen(Qt::white);
+ painter->drawEllipse(r.adjusted(5,5,-5,-5));
+ painter->setBrush(m_color);
+ painter->drawEllipse(r.adjusted(7,7,-7,-7));
+ }
+ painter->restore();
+}
+
+void LayoutMarker::setHeight(qreal height)
+{
+ if (m_rect.height()!=height){
+ prepareGeometryChange();
+ m_rect.setHeight(height);
+ }
+}
+
+void LayoutMarker::setWidth(qreal width)
+{
+ if (m_rect.width()!=width){
+ prepareGeometryChange();
+ m_rect.setWidth(width);
+ }
+}
+
+void LayoutMarker::setColor(QColor color)
+{
+ if (m_color!=color){
+ m_color = color;
+ update(boundingRect());
+ }
+}
+
+void LayoutMarker::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (event->button()==Qt::LeftButton) {
+ if (!(event->modifiers() & Qt::ControlModifier))
+ m_layout->scene()->clearSelection();
+ m_layout->setSelected(true);
+ //m_layout->setChildVisibility(false);
+ update(0,0,boundingRect().width(),boundingRect().width());
+ }
+}
+
+} // namespace LimeReport
diff --git a/src/items/lrhorizontallayout.h b/src/items/lrhorizontallayout.h
new file mode 100644
index 0000000..5e480be
--- /dev/null
+++ b/src/items/lrhorizontallayout.h
@@ -0,0 +1,101 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRHORIZONTALLAYOUT_H
+#define LRHORIZONTALLAYOUT_H
+#include "lritemdesignintf.h"
+
+namespace LimeReport
+{
+
+class HorizontalLayout;
+
+class LayoutMarker : public QGraphicsItem{
+public:
+ explicit LayoutMarker(HorizontalLayout* layout, QGraphicsItem *parent=0);
+ virtual QRectF boundingRect() const{return m_rect;}
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
+ void setHeight(qreal height);
+ void setWidth(qreal width);
+ void setColor(QColor color);
+ qreal width(){return m_rect.width();}
+ qreal height(){return m_rect.height();}
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+private:
+ QRectF m_rect;
+ QColor m_color;
+ HorizontalLayout* m_layout;
+};
+
+class HorizontalLayout : public LayoutDesignIntf
+{
+ Q_OBJECT
+public:
+ HorizontalLayout(QObject *owner = 0, QGraphicsItem *parent = 0);
+ ~HorizontalLayout();
+ BaseDesignIntf *createSameTypeItem(QObject *owner = 0, QGraphicsItem *parent = 0);
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
+ void geometryChangedEvent(QRectF newRect, QRectF);
+ void addChild(BaseDesignIntf *item,bool updateSize=true);
+ friend class BaseDesignIntf;
+ void restoreChild(BaseDesignIntf *item);
+ bool isEmpty() const;
+protected:
+ void collectionLoadFinished(const QString &collectionName);
+ void objectLoadFinished();
+ void updateLayoutSize();
+ void relocateChildren();
+ void beforeDelete();
+ void updateItemSize(RenderPass pass, int maxHeight);
+ bool isNeedUpdateSize(RenderPass pass) const;
+ void childAddedEvent(BaseDesignIntf *child);
+ void setChildVisibility(bool value);
+ int childrenCount();
+ void initMode(ItemMode mode);
+
+ bool canBeSplitted(int height) const;
+ BaseDesignIntf* cloneUpperPart(int height, QObject* owner=0, QGraphicsItem* parent=0);
+ BaseDesignIntf* cloneBottomPart(int height, QObject *owner=0, QGraphicsItem *parent=0);
+
+private slots:
+ void slotOnChildDestroy(QObject *child);
+ void slotOnChildGeometryChanged(QObject*, QRectF newGeometry, QRectF);
+ //void slotOnPosChanged(QObject*, QPointF newPos, QPointF );
+private:
+ QList m_children;
+ bool m_isRelocating;
+ LayoutMarker* m_layoutMarker;
+
+ friend class LayoutMarker;
+};
+
+} //namespace LimeReport
+#endif // LRHORIZONTALLAYOUT_H
diff --git a/src/items/lrimageitem.cpp b/src/items/lrimageitem.cpp
new file mode 100644
index 0000000..c573167
--- /dev/null
+++ b/src/items/lrimageitem.cpp
@@ -0,0 +1,261 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrimageitem.h"
+#include "lrdesignelementsfactory.h"
+#include "lrglobal.h"
+#include "lrdatasourcemanager.h"
+
+namespace{
+
+const QString xmlTag = "ImageItem";
+
+LimeReport::BaseDesignIntf * createImageItem(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::ImageItem(owner,parent);
+}
+bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTag, LimeReport::ItemAttribs(QObject::tr("Image Item"),"Item"), createImageItem
+ );
+}
+
+namespace LimeReport{
+
+ImageItem::ImageItem(QObject* owner,QGraphicsItem* parent)
+ :ItemDesignIntf(xmlTag,owner,parent),m_autoSize(false), m_scale(true), m_keepAspectRatio(true), m_center(true){}
+
+BaseDesignIntf *ImageItem::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new ImageItem(owner,parent);
+}
+
+void ImageItem::updateItemSize(RenderPass , int )
+{
+ if (!m_datasource.isEmpty() && !m_field.isEmpty() && m_picture.isNull()){
+ DataSourceManager* dm = DataSourceManager::instance();
+ IDataSource* ds = dm->dataSource(m_datasource);
+ if (ds) {
+ QVariant data = ds->data(m_field);
+ if (data.isValid()){
+ if (data.type()==QVariant::Image){
+ m_picture = data.value();
+ } else
+ m_picture.loadFromData(data.toByteArray());
+ }
+ }
+ }
+ if (m_autoSize){
+ setWidth(m_picture.width());
+ setHeight(m_picture.height());
+ }
+}
+
+bool ImageItem::isNeedUpdateSize(RenderPass) const
+{
+ return m_picture.isNull() || m_autoSize;
+}
+
+qreal ImageItem::minHeight() const{
+ if (!m_picture.isNull() && autoSize())
+ {
+ return m_picture.height();
+ } else {
+ return 0;
+ }
+}
+
+bool ImageItem::center() const
+{
+ return m_center;
+}
+
+void ImageItem::setCenter(bool center)
+{
+ if (m_center != center){
+ m_center = center;
+ update();
+ notify("center",!center,center);
+ }
+}
+
+bool ImageItem::keepAspectRatio() const
+{
+ return m_keepAspectRatio;
+}
+
+void ImageItem::setKeepAspectRatio(bool keepAspectRatio)
+{
+ if (m_keepAspectRatio != keepAspectRatio){
+ m_keepAspectRatio = keepAspectRatio;
+ update();
+ notify("keepAspectRatio",!keepAspectRatio,keepAspectRatio);
+ }
+}
+
+bool ImageItem::scale() const
+{
+ return m_scale;
+}
+
+void ImageItem::setScale(bool scale)
+{
+ if (m_scale != scale){
+ m_scale = scale;
+ update();
+ notify("scale",!scale,scale);
+ }
+}
+bool ImageItem::autoSize() const
+{
+ return m_autoSize;
+}
+
+void ImageItem::setAutoSize(bool autoSize)
+{
+ if (m_autoSize != autoSize){
+ m_autoSize = autoSize;
+ if (m_autoSize && !m_picture.isNull()){
+ setWidth(image().width());
+ setHeight(image().height());
+ setPosibleResizeDirectionFlags(Fixed);
+ } else {
+ setPosibleResizeDirectionFlags(AllDirections);
+ }
+ update();
+ notify("autoSize",!autoSize,autoSize);
+ }
+}
+
+QString ImageItem::field() const
+{
+ return m_field;
+}
+
+void ImageItem::setField(const QString &field)
+{
+ if (m_field != field){
+ QString oldValue = m_field;
+ m_field = field;
+ update();
+ notify("field",oldValue,field);
+ }
+}
+
+QString ImageItem::datasource() const
+{
+ return m_datasource;
+}
+
+void ImageItem::setDatasource(const QString &datasource)
+{
+ if (m_datasource != datasource){
+ QString oldValue = m_datasource;
+ m_datasource = datasource;
+ update();
+ notify("datasource",oldValue,datasource);
+ }
+}
+
+
+void ImageItem::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ ppainter->save();
+ if (isSelected()) ppainter->setOpacity(SELECTION_OPACITY);
+ else ppainter->setOpacity(qreal(opacity())/100);
+
+ QPointF point = rect().topLeft();
+ QImage img;
+
+ if (m_scale && !image().isNull()){
+ img = image().scaled(rect().width(), rect().height(), keepAspectRatio() ? Qt::KeepAspectRatio : Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ } else {
+ img = image();
+ }
+
+ qreal shiftHeight = rect().height() - img.height();
+ qreal shiftWidth = rect().width() - img.width();
+
+ if (m_center){
+ if (shiftHeight<0 || shiftWidth<0){
+ qreal cutX = 0;
+ qreal cutY = 0;
+ qreal cutWidth = img.width();
+ qreal cutHeigth = img.height();
+
+ if (shiftWidth > 0){
+ point.setX(point.x()+shiftWidth/2);
+ } else {
+ cutX = abs(shiftWidth/2);
+ cutWidth += shiftWidth;
+ }
+
+ if (shiftHeight > 0){
+ point.setY(point.x()+shiftHeight/2);
+ } else {
+ cutY = abs(shiftHeight/2);
+ cutHeigth += shiftHeight;
+ }
+
+ img = img.copy(cutX,cutY,cutWidth,cutHeigth);
+ } else {
+ point.setX(point.x()+shiftWidth/2);
+ point.setY(point.y()+shiftHeight/2);
+ }
+ }
+
+ if (img.isNull() && itemMode()==DesignMode){
+ QString text;
+ ppainter->setFont(transformToSceneFont(QFont("Arial",10)));
+ if (!datasource().isEmpty() && !field().isEmpty())
+ text = datasource()+"."+field();
+ else text = tr("Image");
+ ppainter->drawText(rect().adjusted(4,4,-4,-4), Qt::AlignCenter, text );
+ } else {
+ ppainter->drawImage(point,img);
+ }
+ ItemDesignIntf::paint(ppainter,option,widget);
+ ppainter->restore();
+}
+
+void ImageItem::setImage(QImage value)
+{
+ if (m_picture!=value){
+ QImage oldValue = m_picture;
+ m_picture=value;
+ if (m_autoSize){
+ setWidth(m_picture.width());
+ setHeight(m_picture.height());
+ }
+ update();
+ notify("image",oldValue,value);
+ }
+}
+
+
+
+}
diff --git a/src/items/lrimageitem.h b/src/items/lrimageitem.h
new file mode 100644
index 0000000..7a0f734
--- /dev/null
+++ b/src/items/lrimageitem.h
@@ -0,0 +1,85 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRIMAGEITEM_H
+#define LRIMAGEITEM_H
+#include "lritemdesignintf.h"
+
+namespace LimeReport{
+
+class ImageItem : public LimeReport::ItemDesignIntf
+{
+ Q_OBJECT
+ Q_PROPERTY(QImage image READ image WRITE setImage)
+ Q_PROPERTY(int opacity READ opacity WRITE setOpacity)
+ Q_PROPERTY(QString datasource READ datasource WRITE setDatasource)
+ Q_PROPERTY(QString field READ field WRITE setField)
+ Q_PROPERTY(bool autoSize READ autoSize WRITE setAutoSize)
+ Q_PROPERTY(bool scale READ scale WRITE setScale)
+ Q_PROPERTY(bool keepAspectRatio READ keepAspectRatio WRITE setKeepAspectRatio)
+ Q_PROPERTY(bool center READ center WRITE setCenter)
+public:
+ ImageItem(QObject *owner, QGraphicsItem *parent);
+ virtual void paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ void setImage(QImage value);
+ QImage image(){return m_picture;}
+ void setContent(const QString &value){m_content=value;}
+ QString datasource() const;
+ void setDatasource(const QString &datasource);
+ QString field() const;
+ void setField(const QString &field);
+
+ bool autoSize() const;
+ void setAutoSize(bool autoSize);
+ bool scale() const;
+ void setScale(bool scale);
+ bool keepAspectRatio() const;
+ void setKeepAspectRatio(bool keepAspectRatio);
+ bool center() const;
+ void setCenter(bool center);
+
+ qreal minHeight() const;
+
+protected:
+ BaseDesignIntf* createSameTypeItem(QObject *owner, QGraphicsItem *parent);
+ void updateItemSize(RenderPass, int);
+ bool isNeedUpdateSize(RenderPass) const;
+private:
+ QImage m_picture;
+ QString m_content;
+ QString m_datasource;
+ QString m_field;
+ bool m_autoSize;
+ bool m_scale;
+ bool m_keepAspectRatio;
+ bool m_center;
+};
+
+}
+#endif // LRIMAGEITEM_H
diff --git a/src/items/lrshapeitem.cpp b/src/items/lrshapeitem.cpp
new file mode 100644
index 0000000..390ded6
--- /dev/null
+++ b/src/items/lrshapeitem.cpp
@@ -0,0 +1,190 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrshapeitem.h"
+#include "lrdesignelementsfactory.h"
+#include
+#include
+
+namespace{
+
+const QString xmlTag = "ShapeItem";
+
+LimeReport::BaseDesignIntf * createShapeItem(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::ShapeItem(owner,parent);
+}
+bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
+ xmlTag, LimeReport::ItemAttribs(QObject::tr("Shape Item"),"Item"), createShapeItem
+ );
+}
+
+
+namespace LimeReport{
+
+ShapeItem::ShapeItem(QObject *owner, QGraphicsItem *parent)
+ :ItemDesignIntf(xmlTag,owner,parent),
+ m_shape(HorizontalLine),
+ m_shapeColor(Qt::black),
+ m_shapeBrushColor(Qt::black),
+ m_shapeBrushType(Qt::NoBrush),
+ m_lineWidth(1),
+ m_penStyle(Qt::SolidLine),
+ m_opacity(100)
+{
+}
+
+void ShapeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ painter->save();
+
+ QPen pen(m_shapeColor);
+ pen.setWidthF(m_lineWidth);
+ pen.setStyle(m_penStyle);
+ painter->setPen(pen);
+ QBrush brush(m_shapeBrushColor,m_shapeBrushType);
+
+ painter->setBrush(brush);
+ painter->setBackground(QBrush(Qt::NoBrush));
+ painter->setOpacity(qreal(m_opacity)/100);
+
+ switch (m_shape){
+ case HorizontalLine:
+ painter->drawLine(0,rect().height()/2,rect().right(),rect().height()/2);
+ break;
+ case VerticalLine:
+ painter->drawLine(rect().width()/2,0,rect().width()/2,rect().height());
+ break;
+ case Ellipse:
+ painter->setRenderHint(QPainter::Antialiasing);
+ painter->drawEllipse(rect());
+ break;
+ case Rectangle:
+ painter->setRenderHint(QPainter::Antialiasing);
+ painter->drawRect(rect());
+ break;
+ }
+ painter->restore();
+ ItemDesignIntf::paint(painter,option,widget);
+
+}
+
+void ShapeItem::setShapeColor(QColor value)
+{
+ if ((value!=m_shapeColor)){
+ QColor oldValue = m_shapeColor;
+ m_shapeColor=value;
+ update();
+ notify("shapeColor",oldValue,value);
+ }
+}
+
+void ShapeItem::setShapeBrushColor(QColor value)
+{
+ if (value!=m_shapeBrushColor){
+ QColor oldValue = m_shapeBrushColor;
+ m_shapeBrushColor=value;
+ update();
+ notify("shapeBrushColor",oldValue,value);
+ }
+}
+
+void ShapeItem::setShapeBrushType(Qt::BrushStyle value)
+{
+ if (m_shapeBrushType!=value){
+ Qt::BrushStyle oldValue = m_shapeBrushType;
+ m_shapeBrushType=value;
+ update(rect());
+ notify("shapeBrush",QBrush(oldValue),QBrush(value));
+ }
+}
+
+void ShapeItem::setShapeType(ShapeItem::ShapeType value)
+{
+ if (m_shape!=value){
+ ShapeType oldValue = m_shape;
+ m_shape=value;
+ update();
+ notify("shape",oldValue,value);
+ }
+}
+
+void ShapeItem::setLineWidth(qreal value)
+{
+ if (m_lineWidth!=value){
+ qreal oldValue = m_lineWidth;
+ m_lineWidth=value;
+ update();
+ notify("lineWidth",oldValue,value);
+
+ }
+}
+
+Qt::PenStyle ShapeItem::penStyle() const
+{
+ return m_penStyle;
+}
+
+void ShapeItem::setPenStyle(const Qt::PenStyle &value)
+{
+ if (m_penStyle!=value){
+ Qt::PenStyle oldValue = m_penStyle;
+ m_penStyle = value;
+ update();
+ notify("penStyle",(int)oldValue,(int)value);
+ }
+}
+
+BaseDesignIntf *ShapeItem::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new ShapeItem(owner,parent);
+}
+int ShapeItem::opacity() const
+{
+ return m_opacity;
+}
+
+void ShapeItem::setOpacity(int opacity)
+{
+ if (m_opacity!=opacity){
+ if (opacity < 0) {
+ m_opacity = 0;
+ }
+ else if (opacity > 100) {
+ m_opacity = 100;
+ }
+ else {
+ m_opacity = opacity;
+ }
+ update();
+ }
+}
+
+
+
+}
diff --git a/src/items/lrshapeitem.h b/src/items/lrshapeitem.h
new file mode 100644
index 0000000..84cc6d9
--- /dev/null
+++ b/src/items/lrshapeitem.h
@@ -0,0 +1,79 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRSHAPEITEM_H
+#define LRSHAPEITEM_H
+#include "lritemdesignintf.h"
+
+namespace LimeReport{
+
+class ShapeItem: public LimeReport::ItemDesignIntf
+{
+ Q_OBJECT
+ Q_ENUMS(ShapeType)
+ Q_PROPERTY(ShapeType shape READ shapeType WRITE setShapeType)
+ Q_PROPERTY(QColor shapeColor READ shapeColor WRITE setShapeColor)
+ Q_PROPERTY(QColor shapeBrushColor READ shapeBrushColor WRITE setShapeBrushColor)
+ Q_PROPERTY(Qt::BrushStyle shapeBrush READ shapeBrushType WRITE setShapeBrushType)
+ Q_PROPERTY(qreal lineWidth READ lineWidth WRITE setLineWidth)
+ Q_PROPERTY(Qt::PenStyle penStyle READ penStyle WRITE setPenStyle)
+ Q_PROPERTY(int opacity READ opacity WRITE setOpacity)
+public:
+ enum ShapeType{HorizontalLine,VerticalLine,Ellipse,Rectangle};
+ ShapeItem(QObject *owner, QGraphicsItem *parent);
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ void setShapeColor(QColor value);
+ QColor shapeColor() const {return m_shapeColor;}
+ void setShapeBrushColor(QColor value);
+ QColor shapeBrushColor() const {return m_shapeBrushColor;}
+ void setShapeBrushType(Qt::BrushStyle value);
+ Qt::BrushStyle shapeBrushType() const {return m_shapeBrushType;}
+ void setShapeType(ShapeType value);
+ ShapeType shapeType() const {return m_shape;}
+ void setLineWidth(qreal value);
+ qreal lineWidth() const {return m_lineWidth;}
+ Qt::PenStyle penStyle() const;
+ void setPenStyle(const Qt::PenStyle &value);
+ int opacity() const;
+ void setOpacity(int opacity);
+
+protected:
+ virtual BaseDesignIntf* createSameTypeItem(QObject *owner, QGraphicsItem *parent);
+private:
+ ShapeType m_shape;
+ QColor m_shapeColor;
+ QColor m_shapeBrushColor;
+ Qt::BrushStyle m_shapeBrushType;
+ qreal m_lineWidth;
+ Qt::PenStyle m_penStyle;
+ int m_opacity;
+};
+
+}
+#endif // LRSHAPEITEM_H
diff --git a/src/items/lrsimpletagparser.cpp b/src/items/lrsimpletagparser.cpp
new file mode 100644
index 0000000..128cb8c
--- /dev/null
+++ b/src/items/lrsimpletagparser.cpp
@@ -0,0 +1,238 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrsimpletagparser.h"
+#include
+#include
+#include
+
+namespace LimeReport{
+void HtmlContext::fillTagVector(QString html)
+{
+ QRegExp rx("<[^<]*>");
+ QString buff=html;
+ int curPos=0;
+ while(buff.contains(rx)){
+ int pos=rx.indexIn(buff);
+ curPos+=pos;
+ buff=buff.right(buff.length()-pos);
+ if (rx.cap().at(1)!='/'){
+ int initPos=curPos;
+ parseTag(m_tags,buff,initPos);
+ }
+ buff=buff.right(buff.length()-rx.matchedLength());
+ }
+}
+
+QString HtmlContext::parseTag(QVector &storage, QString text, int &curPos, bool createTag)
+{
+ QRegExp rx("<[^<]*>");
+ int pos=rx.indexIn(text);
+ int begPos=pos+curPos;
+ QString buff=text.right(text.length()-(pos+rx.matchedLength()));
+
+ QString tagName=rx.cap(0);
+ tagName.remove('<');
+ tagName.remove('>');
+
+ while (buff.contains(rx)){
+ int pos=rx.indexIn(buff);
+ buff=buff.right(buff.length()-pos);
+ curPos+=pos;
+ if (extractWord(rx.cap(0),1).compare(extractWord(tagName,1),Qt::CaseInsensitive)==0){
+ if (rx.cap(0).at(1)=='/'){
+ if (createTag) storage.append(new Tag(tagName,begPos,curPos));
+ return buff.right(buff.length()-rx.matchedLength());
+ } else {
+ buff=parseTag(storage,buff,curPos,false);
+
+ }
+ } else {
+ buff=buff.right(buff.length()-rx.matchedLength());
+ }
+ }
+ return "";
+}
+
+void HtmlContext::parseSymbs(QString text)
+{
+
+ QRegExp rx("<[^<]*[^/]>");
+ while (text.contains(rx)){
+ int pos=rx.indexIn(text);
+ if (rx.cap().compare(" ",Qt::CaseInsensitive)==0)
+ m_symbs.append(new Symb(rx.cap(),pos));
+ text.remove(pos,rx.matchedLength());
+ }
+
+ foreach(QString pattern,m_symbPatterns){
+ rx.setPattern(pattern);
+ while (text.contains(rx)){
+ int pos=rx.indexIn(text);
+ m_symbs.append(new Symb(rx.cap(0),pos));
+ text.replace(rx.cap(0)," ");
+ }
+ }
+}
+
+void HtmlContext::initSymbPatterns()
+{
+ m_symbPatterns<<"&[^&]*;"<<"<[^<]*/>";
+}
+
+HtmlContext::HtmlContext(QString html)
+{
+ fillTagVector(html);
+ parseSymbs(html);
+ initSymbPatterns();
+}
+
+HtmlContext::~HtmlContext()
+{
+ clearTags();
+ clearSymbs();
+}
+
+QString HtmlContext::extractWord(QString text, int index)
+{
+ text.remove('<');
+ text.remove('>');
+ text.remove('/');
+ int counter=1;
+ QString retWord("");
+ for (int i=0;i HtmlContext::tagVectDiff(QVector source, QVector dest)
+{
+ QVector resVect;
+ for(int i=0;i source, QVector dest)
+{
+ if (source.count()!=dest.count()) return false;
+ foreach(Tag* tag,source){
+ if (!dest.contains(tag)) return false;
+ }
+ return true;
+}
+
+QString HtmlContext::extendTextByTags(QString text, int pos)
+{
+ QString curText="";
+ QVector curTags=tagsAt(pos);
+ for(int i=0;itagText()+'>';
+ }
+
+ for(int i=0;i tagsAtPos=tagsAt(pos);
+ if (!HtmlContext::isVectorEqual(curTags,tagsAtPos)){
+ QVector diffs=HtmlContext::tagVectDiff(curTags,tagsAtPos);
+ foreach(TagDiff diff,diffs){
+ if (diff.direction==TagDiff::Inner){
+ curText+='<'+diff.tag->tagText()+'>';
+ curTags.append(diff.tag);
+ }
+ else{
+ curText+=""+HtmlContext::extractWord(diff.tag->tagText(),1)+'>';
+ curTags.remove(curTags.indexOf(diff.tag));
+ }
+ }
+ }
+ Symb s=symbAt(pos);
+ if (s.isValid()){
+ if (s.isTag()) curText+=s.text()+text.at(i);
+ else curText+=s.text();
+ } else curText+=text.at(i);
+ }
+
+ curTags=tagsAt(pos);
+ for(int i=0;itagText(),1)+'>';
+ }
+
+ return curText;
+}
+
+QVector HtmlContext::tagsAt(int pos)
+{
+ QVector result;
+ foreach(Tag* tag,m_tags){
+ if ((pos>=tag->begin())&&(pos<=tag->end())) result.append(tag);
+ }
+ return result;
+}
+
+Symb HtmlContext::symbAt(int pos)
+{
+ foreach(Symb* symb,m_symbs){
+ if (pos==symb->pos()) return *symb;
+ }
+ return Symb();
+}
+
+void HtmlContext::clearTags()
+{
+ foreach(Tag* tag,m_tags) delete tag;
+ m_tags.clear();
+}
+
+void HtmlContext::clearSymbs()
+{
+ foreach(Symb* symb,m_symbs) delete symb;
+ m_tags.clear();
+}
+
+}
diff --git a/src/items/lrsimpletagparser.h b/src/items/lrsimpletagparser.h
new file mode 100644
index 0000000..6463edc
--- /dev/null
+++ b/src/items/lrsimpletagparser.h
@@ -0,0 +1,100 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRSIMPLETAGPARSER_H
+#define LRSIMPLETAGPARSER_H
+
+#include
+#include
+#include
+
+namespace LimeReport{
+
+class Tag{
+public:
+ Tag(QString text,int beginPos,int endPos)
+ :m_tagText(text),m_beginPos(beginPos),m_endPos(endPos){}
+ Tag():m_tagText(""),m_beginPos(-1),m_endPos(-1){}
+ bool isValid(){return (!m_tagText.isEmpty())&&(m_beginPos>0)&&(m_endPos>0);}
+ QString tagText() const {return m_tagText;}
+ int begin() const {return m_beginPos;}
+ int end() const {return m_endPos;}
+private:
+ QString m_tagText;
+ int m_beginPos;
+ int m_endPos;
+};
+
+class Symb{
+public:
+ Symb(QString text, int pos):m_text(text),m_pos(pos){}
+ Symb():m_text(""),m_pos(-1){}
+ bool isValid(){return (!m_text.isEmpty())&&(m_pos>0);}
+ bool isTag(){return isValid()&&m_text.at(0)=='<';}
+ QString text(){return m_text;}
+ int pos(){return m_pos;}
+private:
+ QString m_text;
+ int m_pos;
+};
+
+struct TagDiff{
+ enum Direction {
+ Inner=0,
+ Outer=1
+ };
+ Tag* tag;
+ Direction direction;
+};
+
+class HtmlContext
+{
+public:
+ HtmlContext(QString html);
+ ~HtmlContext();
+ static QString extractWord(QString text,int index);
+ static QVector tagVectDiff(QVector source, QVector dest);
+ static bool isVectorEqual(QVector source, QVector dest);
+ void fillTagVector(QString html);
+ QString extendTextByTags(QString text, int pos);
+ QVector tagsAt(int pos);
+ Symb symbAt(int pos);
+ void clearTags();
+ void clearSymbs();
+private:
+ static QString parseTag(QVector& storage,QString text,int& curPos, bool createTag=true);
+ void parseSymbs(QString text);
+ void initSymbPatterns();
+private:
+ QVector m_tags;
+ QVector m_symbs;
+ QStringList m_symbPatterns;
+};
+}
+#endif // LRSIMPLETAGPARSER_H
diff --git a/src/items/lrsubitemparentpropitem.cpp b/src/items/lrsubitemparentpropitem.cpp
new file mode 100644
index 0000000..3380660
--- /dev/null
+++ b/src/items/lrsubitemparentpropitem.cpp
@@ -0,0 +1,97 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrsubitemparentpropitem.h"
+#include "../objectinspector/editors/lrcomboboxeditor.h"
+#include "lrbasedesignintf.h"
+#include "lritemdesignintf.h"
+#include "lrpagedesignintf.h"
+#include "lrobjectpropitem.h"
+
+
+namespace{
+ LimeReport::ObjectPropItem * createLocationPropItem(
+ QObject *object, LimeReport::ObjectPropItem::ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& data, LimeReport::ObjectPropItem* parent, bool readonly)
+ {
+ return new LimeReport::ItemLocationPropItem(object, objects, name, displayName, data, parent, readonly);
+ }
+ bool registred = LimeReport::ObjectPropFactory::instance().registerCreator(
+ LimeReport::APropIdent("itemLocation","LimeReport::ItemDesignIntf"),QObject::tr("itemLocation"),createLocationPropItem
+ );
+}
+
+LimeReport::ItemLocationPropItem::ItemLocationPropItem(QObject* object, ObjectsList* objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem* parent, bool readonly)
+ :LimeReport::ObjectPropItem(object, objects, name, displayName, value, parent, readonly){
+ m_locationMap.insert("Band",LimeReport::ItemDesignIntf::Band);
+ m_locationMap.insert("Page",LimeReport::ItemDesignIntf::Page);
+}
+
+
+QWidget * LimeReport::ItemLocationPropItem::createProperyEditor(QWidget *parent) const{
+ ComboBoxEditor *editor = new ComboBoxEditor(parent);
+ connect(editor,SIGNAL(currentIndexChanged(QString)),this,SLOT(slotLocationChanged(QString)));
+ LimeReport::BaseDesignIntf *item=dynamic_cast(object());
+ if (item){
+ QStringList locationTypes;
+ foreach(QString location,m_locationMap.keys()){
+ locationTypes.append(location);
+ }
+ editor->addItems(locationTypes);
+ }
+ return editor;
+}
+
+QString LimeReport::ItemLocationPropItem::displayValue() const{
+ return locationToString(static_cast(propertyValue().toInt()));
+}
+
+void LimeReport::ItemLocationPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const{
+ ComboBoxEditor *editor=qobject_cast(propertyEditor);
+ editor->setTextValue(locationToString(propertyValue().toInt()));
+}
+
+void LimeReport::ItemLocationPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index){
+ object()->setProperty(propertyName().toLatin1(),stringToLocation(qobject_cast(propertyEditor)->text()));
+ model->setData(index,object()->property(propertyName().toLatin1()));
+}
+
+QString LimeReport::ItemLocationPropItem::locationToString(LimeReport::ItemDesignIntf::LocationType location) const{
+ return m_locationMap.key(location);
+}
+
+LimeReport::ItemDesignIntf::LocationType LimeReport::ItemLocationPropItem::stringToLocation(const QString &locationName){
+ return m_locationMap.value(locationName);
+}
+
+void LimeReport::ItemLocationPropItem::slotLocationChanged(const QString &text){
+ if ( locationToString(object()->property(propertyName().toLatin1()).toInt())!=text){
+ object()->setProperty(propertyName().toLatin1(),stringToLocation(text));
+ dynamic_cast(sender())->setTextValue(locationToString(object()->property(propertyName().toLatin1()).toInt()));
+ }
+}
diff --git a/src/items/lrsubitemparentpropitem.h b/src/items/lrsubitemparentpropitem.h
new file mode 100644
index 0000000..9aa420e
--- /dev/null
+++ b/src/items/lrsubitemparentpropitem.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRSUBITEMPARENTPROPITEM_H
+#define LRSUBITEMPARENTPROPITEM_H
+
+#include
+
+#include "lrobjectpropitem.h"
+#include "lritemdesignintf.h"
+
+namespace LimeReport{
+class ItemLocationPropItem : public LimeReport::ObjectPropItem{
+ Q_OBJECT
+public:
+ ItemLocationPropItem():ObjectPropItem(){}
+ ItemLocationPropItem(QObject* object, ObjectsList* objects, const QString& name, const QString& displayName, const QVariant& value, ObjectPropItem* parent, bool readonly);
+ QWidget* createProperyEditor(QWidget *parent) const;
+ QString displayValue() const;
+ void setPropertyEditorData(QWidget *, const QModelIndex &) const;
+ void setModelData(QWidget *, QAbstractItemModel *, const QModelIndex &);
+private slots:
+ void slotLocationChanged(const QString& text);
+private:
+ QString locationToString(LimeReport::ItemDesignIntf::LocationType location) const;
+ QString locationToString(int location) const {return locationToString(static_cast(location));}
+ LimeReport::ItemDesignIntf::LocationType stringToLocation(const QString& locationName);
+private:
+ QMap m_locationMap;
+};
+}
+#endif // LRSUBITEMPARENTPROPITEM_H
diff --git a/src/items/lrtextitem.cpp b/src/items/lrtextitem.cpp
new file mode 100644
index 0000000..1a83a14
--- /dev/null
+++ b/src/items/lrtextitem.cpp
@@ -0,0 +1,504 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include
+#include
+#include
+#include
+
+#include "lrpagedesignintf.h"
+#include "lrtextitem.h"
+#include "lrdesignelementsfactory.h"
+#include "lrglobal.h"
+#include "lrdatasourcemanager.h"
+#include "lrsimpletagparser.h"
+#include "lrtextitemeditor.h"
+#include "lrreportengine_p.h"
+
+namespace{
+
+const QString xmlTag = "TextItem";
+
+LimeReport::BaseDesignIntf * createTextItem(QObject* owner, LimeReport::BaseDesignIntf* parent){
+ return new LimeReport::TextItem(owner,parent);
+}
+bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(xmlTag, LimeReport::ItemAttribs(QObject::tr("Text Item"),"TextItem"), createTextItem);
+
+}
+
+namespace LimeReport{
+
+TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
+ : ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0),m_trimValue(true){
+ m_text = new QTextDocument();
+ Init();
+}
+
+TextItem::TextItem(const QString& text, QObject* owner /*= 0*/, QGraphicsItem* parent /*= 0*/)
+ : ContentItemDesignIntf(xmlTag, owner,parent), m_angle(Angle0), m_trimValue(true){
+ m_strText = text;
+ m_text = new QTextDocument(text);
+ m_text->setHtml(replaceReturns(m_strText));
+ initText();
+ Init();
+}
+
+TextItem::~TextItem()
+{
+ delete m_text;
+}
+
+void TextItem::paint(QPainter* ppainter, const QStyleOptionGraphicsItem* style, QWidget* widget) {
+ Q_UNUSED(widget);
+ Q_UNUSED(style);
+
+ ppainter->save();
+
+ setupPainter(ppainter);
+ prepareRect(ppainter,style,widget);
+
+ QSizeF tmpSize = rect().size()-m_textSize;
+
+ if ((tmpSize.height()>0) && (m_alignment & Qt::AlignVCenter)) //allow html
+ ppainter->translate(0,tmpSize.height()/2);
+
+ if ((tmpSize.height()>0) && (m_alignment & Qt::AlignBottom)) // allow html
+ ppainter->translate(0,tmpSize.height());
+
+ if (!ppainter->clipRegion().isEmpty()){
+ QRegion clipReg=ppainter->clipRegion().xored(ppainter->clipRegion().subtracted(rect().toRect()));
+ ppainter->setClipRegion(clipReg);
+ } else {
+ ppainter->setClipRect(rect());
+ }
+
+ switch (m_angle){
+ case Angle90:
+ ppainter->translate(width(),0);
+ ppainter->rotate(90);
+ break;
+ case Angle180:
+ ppainter->translate(width(),height());
+ ppainter->rotate(180);
+ break;
+ case Angle270:
+ ppainter->translate(0,height());
+ ppainter->rotate(270);
+ break;
+ case Angle45:
+ ppainter->translate(width()/2,0);
+ ppainter->rotate(45);
+ m_text->setTextWidth(sqrt(2*(pow(width()/2,2))));
+ break;
+ case Angle315:
+ ppainter->translate(0,height()/2);
+ ppainter->rotate(315);
+ m_text->setTextWidth(sqrt(2*(pow(height()/2,2))));
+ break;
+ default:
+ break;
+ }
+
+ for(QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){
+ for (int i=0;ilineCount();i++){
+ ppainter->setOpacity(qreal(foregroundOpacity())/100);
+ it.layout()->lineAt(i).draw(ppainter,QPointF(marginSize(),0));
+ }
+ }
+
+
+// m_layout.draw(ppainter,QPointF(marginSize(),0),);
+// ppainter->setFont(transformToSceneFont(font()));
+// QTextOption o;
+// o.setAlignment(alignment());
+// ppainter->drawText(rect(), content(), o);
+
+ ppainter->restore();
+ BaseDesignIntf::paint(ppainter, style, widget);
+}
+
+QString TextItem::content() const{
+ return m_strText;
+}
+
+void TextItem::Init()
+{
+ m_autoWidth=NoneAutoWidth;
+ m_alignment= Qt::AlignLeft|Qt::AlignTop;
+ m_autoHeight=false;
+ m_text->setDefaultFont(transformToSceneFont(font()));
+ m_textSize=QSizeF();
+ m_foregroundOpacity = 100;
+}
+
+void TextItem::setContent(const QString &value)
+{
+ if (m_strText.compare(value)!=0){
+ QString oldValue = m_strText;
+ m_strText=value;
+ m_text->setHtml(replaceReturns(value.trimmed()));
+ m_text->setTextWidth(width());
+ m_textSize=m_text->size();
+ if (!isLoading()){
+ update(rect());
+ notify("content",oldValue,value);
+ //updateLayout();
+ }
+ }
+}
+
+void TextItem::updateItemSize(RenderPass pass, int /*maxHeight*/)
+{
+ if (isNeedExpandContent())
+ expandContent(pass);
+ if (!isLoading())
+ initText();
+
+ if (m_textSize.width()>width() && ((m_autoWidth==MaxWordLength)||(m_autoWidth==MaxStringLength))){
+ setWidth(m_textSize.width());
+ }
+
+ if ((m_textSize.height()>height()) && (m_autoHeight) ){
+ setHeight(m_textSize.height()+5);
+ }
+}
+
+void TextItem::updateLayout()
+{
+ m_layout.setFont(transformToSceneFont(font()));
+ m_layout.setText(content());
+ qreal linePos = 0;
+ m_layout.beginLayout();
+ while(true){
+ QTextLine line = m_layout.createLine();
+ if (!line.isValid()) break;
+ line.setLineWidth(width()-marginSize()*2);
+ line.setPosition(QPoint(marginSize(),linePos));
+ linePos+=line.height();
+ }
+ m_layout.endLayout();
+}
+
+bool TextItem::isNeedExpandContent() const
+{
+ QRegExp rx("$*\\{[^{]*\\}");
+ return content().contains(rx);
+}
+
+QString TextItem::replaceBR(QString text)
+{
+ return text.replace(" ","\n");
+}
+
+QString TextItem::replaceReturns(QString text)
+{
+ QString result = text.replace("\r\n"," ");
+ result = result.replace("\n"," ");
+ return result;
+}
+
+void TextItem::initText()
+{
+ QTextOption to;
+ to.setAlignment(m_alignment);
+
+ if (m_autoWidth!=MaxStringLength)
+ to.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
+ else to.setWrapMode(QTextOption::NoWrap);
+
+ m_text->setDocumentMargin(marginSize());
+ m_text->setDefaultTextOption(to);
+ m_text->setDefaultFont(transformToSceneFont(font()));
+ if ((m_angle==Angle0)||(m_angle==Angle180)){
+ m_text->setTextWidth(rect().width());
+ } else {
+ m_text->setTextWidth(rect().height());
+ }
+ m_textSize=m_text->size();
+}
+bool TextItem::trimValue() const
+{
+ return m_trimValue;
+}
+
+void TextItem::setTrimValue(bool trimValue)
+{
+ m_trimValue = trimValue;
+}
+
+
+void TextItem::geometryChangedEvent(QRectF , QRectF)
+{
+ if ((m_angle==Angle0)||(m_angle==Angle180)){
+ m_text->setTextWidth(rect().width());
+ } else {
+ m_text->setTextWidth(rect().height());
+ }
+ m_textSize=m_text->size();
+}
+
+bool TextItem::isNeedUpdateSize(RenderPass pass) const
+{
+ Q_UNUSED(pass)
+ bool res = (m_textSize.height()>geometry().height()&&autoHeight()) ||
+ (m_textSize.width()>geometry().width()&&autoWidth()) ||
+ isNeedExpandContent();
+ return res;
+}
+
+//void TextItem::setMarginSize(int value)
+//{
+// if (m_margin!=value){
+// int oldValue = m_margin;
+// m_margin=value;
+// if (!isLoading()){
+// update(rect());
+// notify("margin", oldValue, value);
+// }
+// }
+//}
+
+void TextItem::setAlignment(Qt::Alignment value)
+{
+ if (m_alignment!=value){
+ Qt::Alignment oldValue = m_alignment;
+ m_alignment=value;
+ m_layout.setTextOption(QTextOption(m_alignment));
+ if (!isLoading()){
+ initText();
+ update(rect());
+ notify("alignment",QVariant(oldValue),QVariant(value));
+ }
+ }
+}
+
+void TextItem::expandContent(RenderPass pass)
+{
+ QString context=content();
+ switch(pass){
+ case FirstPass:
+ context=expandUserVariables(context, pass, NoEscapeSymbols);
+ context=expandScripts(context);
+ context=expandDataFields(context, NoEscapeSymbols);
+ break;
+ case SecondPass:;
+ context=expandUserVariables(context, pass, NoEscapeSymbols);
+ context=expandScripts(context);
+ }
+
+ setContent(context);
+}
+
+void TextItem::setAutoHeight(bool value)
+{
+ if (m_autoHeight!=value){
+ bool oldValue = m_autoHeight;
+ m_autoHeight=value;
+ notify("autoHeight",oldValue,value);
+ }
+}
+
+void TextItem::setAutoWidth(TextItem::AutoWidth value)
+{
+ if (m_autoWidth!=value){
+ TextItem::AutoWidth oldValue = m_autoWidth;
+ m_autoWidth=value;
+ notify("autoWidth",oldValue,value);
+ }
+}
+
+bool TextItem::canBeSplitted(int height) const
+{
+ return height>(m_text->begin().layout()->lineAt(0).height());
+}
+
+BaseDesignIntf *TextItem::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
+{
+ int linesHeight=0;
+ initText();
+ QString tmpText="";
+ TextItem* upperPart = dynamic_cast(cloneItem(itemMode(),owner,parent));
+
+ for (QTextBlock it=m_text->begin();it!=m_text->end();it=it.next()){
+ for (int i=0;ilineCount();i++){
+ linesHeight+=it.layout()->lineAt(i).height();
+ if (linesHeight>(height-(marginSize()*2))) {linesHeight-=it.layout()->lineAt(i).height(); goto loop_exit;}
+ tmpText+=it.text().mid(it.layout()->lineAt(i).textStart(),it.layout()->lineAt(i).textLength())+'\n';
+ }
+ }
+ loop_exit:
+ upperPart->setHeight(linesHeight+marginSize()*2);
+ QScopedPointer context(new HtmlContext(m_strText));
+ upperPart->setContent(context->extendTextByTags(tmpText,0));
+ return upperPart;
+}
+
+BaseDesignIntf *TextItem::cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent)
+{
+ TextItem* bottomPart = dynamic_cast(cloneItem(itemMode(),owner,parent));
+ int linesHeight=0;
+ int curLine=0;
+ QTextBlock curBlock;
+
+ QString tmpText="";
+
+ for (curBlock=m_text->begin();curBlock!=m_text->end();curBlock=curBlock.next()){
+ for (curLine=0;curLinelineCount();curLine++){
+ linesHeight+=curBlock.layout()->lineAt(curLine).height();
+ if (linesHeight>(height-(marginSize()*2))) {goto loop_exit;}
+ }
+ }
+ loop_exit:;
+ int textPos=0;
+ for (;curBlock!=m_text->end();curBlock=curBlock.next()){
+ for (;curLinelineCount();curLine++){
+ if (tmpText=="") textPos= curBlock.layout()->lineAt(curLine).textStart();
+ tmpText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
+ curBlock.layout()->lineAt(curLine).textLength())+"\n";
+ }
+ }
+
+ QScopedPointer context(new HtmlContext(m_strText));
+ bottomPart->setContent(context->extendTextByTags(tmpText,textPos));
+ bottomPart->setHeight(bottomPart->m_textSize.height()+5);
+ return bottomPart;
+}
+
+BaseDesignIntf *TextItem::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
+{
+ return new TextItem(owner,parent);
+}
+
+BaseDesignIntf *TextItem::cloneEmpty(int height, QObject *owner, QGraphicsItem *parent)
+{
+ TextItem* empty=dynamic_cast(cloneItem(itemMode(),owner,parent));
+ empty->setContent("");
+ empty->setHeight(height);
+ return empty;
+}
+
+void TextItem::objectLoadFinished()
+{
+ ItemDesignIntf::objectLoadFinished();
+ initText();
+}
+
+void TextItem::setTextItemFont(QFont value)
+{
+ if (font()!=value){
+ QFont oldValue = font();
+ setFont(value);
+ m_text->setDefaultFont(transformToSceneFont(value));
+ notify("font",oldValue,value);
+ }
+}
+
+QWidget *TextItem::defaultEditor()
+{
+ QSettings* l_settings = (page()->settings() != 0) ?
+ page()->settings() :
+ (page()->reportEditor()!=0) ? page()->reportEditor()->settings() : 0;
+ QWidget* editor = new TextItemEditor(this,page(),l_settings);
+ editor->setAttribute(Qt::WA_DeleteOnClose);
+ return editor;
+}
+
+void TextItem::setBackgroundOpacity(int value)
+{
+ if (opacity()!=value){
+ int oldValue = opacity();
+ setOpacity(value);
+ notify("backgroundOpacity",oldValue,value);
+ }
+}
+
+void TextItem::setBackgroundModeProperty(BaseDesignIntf::BGMode value)
+{
+ if (value!=backgroundMode()){
+ BaseDesignIntf::BGMode oldValue = backgroundMode();
+ setBackgroundMode(value);
+ notify("backgroundMode",oldValue,value);
+ }
+}
+
+void TextItem::setBackgroundColorProperty(QColor value)
+{
+ if(value!=backgroundColor()){
+ QColor oldValue = backgroundColor();
+ setBackgroundColor(value);
+ notify("backgroundMode",oldValue,value);
+ }
+}
+
+void TextItem::setFontColorProperty(QColor value)
+{
+ if(value!=fontColor()){
+ QColor oldValue = fontColor();
+ setFontColor(value);
+ notify("fontColor",oldValue,value);
+ }
+}
+
+TextItem::AngleType TextItem::angle() const
+{
+ return m_angle;
+}
+
+void TextItem::setAngle(const AngleType& value)
+{
+ if (m_angle!=value){
+ AngleType oldValue = m_angle;
+ m_angle = value;
+ if (!isLoading()){
+ initText();
+ update();
+ notify("angle",oldValue,value);
+ }
+ }
+}
+
+void TextItem::setForegroundOpacity(int value)
+{
+ if (value>100){
+ value=100;
+ } else if(value<0){
+ value=0;
+ }
+ if (m_foregroundOpacity != value){
+ int oldValue = m_foregroundOpacity;
+ m_foregroundOpacity = value;
+ update();
+ notify("foregroundOpacity",oldValue,value);
+ }
+}
+
+} //namespace LimeReport
+
+
+
diff --git a/src/items/lrtextitem.h b/src/items/lrtextitem.h
new file mode 100644
index 0000000..f2e2abe
--- /dev/null
+++ b/src/items/lrtextitem.h
@@ -0,0 +1,136 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRTEXTITEM_H
+#define LRTEXTITEM_H
+#include
+#include
+#include
+#include "lritemdesignintf.h"
+#include
+
+#include
+
+namespace LimeReport {
+
+class Tag;
+class TextItem : public LimeReport::ContentItemDesignIntf {
+ Q_OBJECT
+ Q_ENUMS(AutoWidth)
+ Q_ENUMS(AngleType)
+ Q_PROPERTY(QString content READ content WRITE setContent)
+ Q_PROPERTY(int margin READ marginSize WRITE setMarginSize)
+ Q_PROPERTY(Qt::Alignment alignment READ alignment() WRITE setAlignment)
+ Q_PROPERTY(AutoWidth autoWidth READ autoWidth() WRITE setAutoWidth)
+ Q_PROPERTY(bool autoHeight READ autoHeight() WRITE setAutoHeight)
+ Q_PROPERTY(QFont font READ font() WRITE setTextItemFont)
+ Q_PROPERTY(int backgroundOpacity READ opacity WRITE setBackgroundOpacity)
+ Q_PROPERTY(BGMode backgroundMode READ backgroundMode WRITE setBackgroundModeProperty)
+ Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColorProperty)
+ Q_PROPERTY(QColor fontColor READ fontColor WRITE setFontColorProperty)
+ Q_PROPERTY(AngleType angle READ angle WRITE setAngle)
+ Q_PROPERTY(int foregroundOpacity READ foregroundOpacity WRITE setForegroundOpacity())
+ Q_PROPERTY(bool trimValue READ trimValue WRITE setTrimValue)
+public:
+
+ enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
+ enum AngleType{Angle0,Angle90,Angle180,Angle270,Angle45,Angle315};
+
+ void Init();
+ TextItem(QObject* owner,QGraphicsItem* parent);
+ TextItem(const QString& content,QObject* owner = 0, QGraphicsItem* parent = 0);
+ ~TextItem();
+
+ void paint(QPainter* ppainter, const QStyleOptionGraphicsItem*, QWidget*);
+ QString content() const;
+ void setContent(const QString& value);
+
+ //void setMarginSize(int value);
+
+
+ void setAlignment(Qt::Alignment value);
+ Qt::Alignment alignment(){return m_alignment;}
+
+ virtual void geometryChangedEvent(QRectF, QRectF);
+ virtual bool isNeedUpdateSize(RenderPass) const;
+ virtual void updateItemSize(RenderPass pass, int);
+ void expandContent(RenderPass pass);
+
+ void setAutoHeight(bool value);
+ bool autoHeight() const {return m_autoHeight;}
+
+ void setAutoWidth(AutoWidth value);
+ AutoWidth autoWidth() const {return m_autoWidth;}
+
+ bool canBeSplitted(int height) const;
+ bool isSplittable() const { return true;}
+ bool isEmpty() const{return m_text->isEmpty();}
+ BaseDesignIntf* cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent);
+ BaseDesignIntf* cloneBottomPart(int height, QObject *owner, QGraphicsItem *parent);
+ BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
+ BaseDesignIntf* cloneEmpty(int height, QObject *owner, QGraphicsItem *parent);
+ void objectLoadFinished();
+
+ void setTextItemFont(QFont value);
+ virtual QWidget* defaultEditor();
+ void setBackgroundOpacity(int value);
+ void setBackgroundModeProperty(BGMode value);
+ void setBackgroundColorProperty(QColor value);
+ void setFontColorProperty(QColor value);
+ AngleType angle() const;
+ void setAngle(const AngleType& value);
+ int foregroundOpacity(){return m_foregroundOpacity;}
+ void setForegroundOpacity(int value);
+
+ bool trimValue() const;
+ void setTrimValue(bool trimValue);
+
+protected:
+ void updateLayout();
+ bool isNeedExpandContent() const;
+ QString replaceBR(QString text);
+ QString replaceReturns(QString text);
+private:
+ void initText();
+private:
+ QString m_strText;
+
+ QTextLayout m_layout;
+ QTextDocument* m_text;
+ Qt::Alignment m_alignment;
+ bool m_autoHeight;
+ AutoWidth m_autoWidth;
+ QSizeF m_textSize;
+ AngleType m_angle;
+ int m_foregroundOpacity;
+ bool m_trimValue;
+};
+
+}
+#endif // LRTEXTITEM_H
diff --git a/src/items/lrtextitemeditor.cpp b/src/items/lrtextitemeditor.cpp
new file mode 100644
index 0000000..1d8842e
--- /dev/null
+++ b/src/items/lrtextitemeditor.cpp
@@ -0,0 +1,356 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#include "lrtextitemeditor.h"
+#include "ui_lrtextitemeditor.h"
+
+#include "lrdatasourcemanager.h"
+#include "lrscriptenginemanager.h"
+#include "lrdatadesignintf.h"
+#include "lrdatasourcemanager.h"
+#include
+#include
+
+TextItemEditor::TextItemEditor(LimeReport::TextItem *item, LimeReport::PageDesignIntf *page, QSettings* settings, QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::TextItemEditor), m_textItem(item), m_page(page), m_settings(settings), m_ownedSettings(false), m_isReadingSetting(false)
+{
+ ui->setupUi(this);
+ initUI();
+ m_teContent->setPlainText(item->content());
+ m_teContent->setFocus();
+ setWindowIcon(QIcon(":/items/images/TextItem"));
+ readSetting();
+}
+
+TextItemEditor::~TextItemEditor()
+{
+#ifdef Q_OS_WIN
+ writeSetting();
+#endif
+#ifdef Q_OS_MAC
+ writeSetting();
+#endif
+ delete ui;
+}
+
+void TextItemEditor::setSettings(QSettings* value)
+{
+ if (m_ownedSettings)
+ delete m_settings;
+ m_settings=value;
+ m_ownedSettings=false;
+ readSetting();
+}
+
+QSettings*TextItemEditor::settings()
+{
+ if (m_settings){
+ return m_settings;
+ } else {
+ m_settings = new QSettings("LimeReport",QApplication::applicationName());
+ m_ownedSettings = true;
+ return m_settings;
+ }
+}
+
+void TextItemEditor::resizeEvent(QResizeEvent*)
+{
+#ifdef Q_OS_UNIX
+ writeSetting();
+#endif
+}
+
+void TextItemEditor::moveEvent(QMoveEvent*)
+{
+#ifdef Q_OS_UNIX
+ writeSetting();
+#endif
+}
+
+void TextItemEditor::on_pbOk_clicked()
+{
+ if (m_textItem->content()!=m_teContent->toPlainText()){
+ m_textItem->setContent(m_teContent->toPlainText());
+ }
+ close();
+}
+
+void TextItemEditor::initUI()
+{
+ QStringList dataWords;
+ m_teContent = ui->textEdit;
+ m_completer = new QCompleter(this);
+ m_teContent->setCompleter(m_completer);
+
+ m_datasourcesMenu = new QMenu(this);
+
+ LimeReport::DataSourceManager* dm = LimeReport::DataSourceManager::instance();
+ if (dm){
+ ui->twData->setModel(dm->datasourcesModel());
+ ui->twScriptEngine->setModel(LimeReport::ScriptEngineManager::instance().model());
+
+ foreach(QString dsName,dm->dataSourceNames()){
+ foreach(QString field, dm->fieldNames(dsName)){
+ dataWords<tabWidget->setVisible(false);
+ }
+
+ LimeReport::ScriptEngineManager& se = LimeReport::ScriptEngineManager::instance();
+
+ foreach (LimeReport::ScriptFunctionDesc functionDesc, se.functionsDescriber()) {
+ dataWords<setModel(new QStringListModel(dataWords,m_completer));
+ ui->gbSettings->setVisible(false);
+}
+
+QStringListModel *TextItemEditor::getDataSources()
+{
+ LimeReport::DataSourceManager* dm= LimeReport::DataSourceManager::instance();
+ QStringList dataSources;
+ foreach(QString dsName,dm->dataSourceNames()){
+ dataSources<fieldNames(datasource)){
+ fields<(sender());
+ m_teContent->insertPlainText(action->whatsThis());
+}
+
+void TextItemEditor::readSetting()
+{
+ if (settings()==0) return;
+
+ m_isReadingSetting = true;
+
+ settings()->beginGroup("TextItemEditor");
+ QVariant v = settings()->value("Geometry");
+ if (v.isValid()){
+ restoreGeometry(v.toByteArray());
+ }
+ v = settings()->value("State");
+ if (v.isValid()){
+ ui->splitter->restoreState(v.toByteArray());
+ }
+
+ QVariant fontName = settings()->value("FontName");
+ if (fontName.isValid()){
+ QVariant fontSize = settings()->value("FontSize");
+ ui->textEdit->setFont(QFont(fontName.toString(),fontSize.toInt()));
+ ui->editorFont->setCurrentFont(ui->textEdit->font());
+ ui->editorFontSize->setValue(fontSize.toInt());
+ }
+ settings()->endGroup();
+
+ m_isReadingSetting = false;
+}
+
+void TextItemEditor::writeSetting()
+{
+ if (settings()!=0){
+ settings()->beginGroup("TextItemEditor");
+ settings()->setValue("Geometry",saveGeometry());
+ settings()->setValue("State",ui->splitter->saveState());
+ settings()->endGroup();
+ }
+}
+
+
+CompleaterTextEditor::CompleaterTextEditor(QWidget *parent)
+ : QTextEdit(parent),m_compleater(0)
+{
+}
+
+void CompleaterTextEditor::setCompleter(QCompleter *value)
+{
+ if (value) disconnect(value,0,this,0);
+ m_compleater = value;
+ if (!m_compleater) return;
+ m_compleater->setWidget(this);
+ m_compleater->setCompletionMode(QCompleter::PopupCompletion);
+ m_compleater->setCaseSensitivity(Qt::CaseInsensitive);
+ connect(m_compleater,SIGNAL(activated(QString)),this,SLOT(insertCompletion(QString)));
+}
+
+void CompleaterTextEditor::keyPressEvent(QKeyEvent *e)
+{
+ if (m_compleater && m_compleater->popup()->isVisible()) {
+ switch (e->key()) {
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ case Qt::Key_Escape:
+ case Qt::Key_Tab:
+ case Qt::Key_Backtab:
+ e->ignore();
+ return;
+ default:
+ break;
+ }
+ }
+
+ bool isShortcut = ((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_E);
+ if (!m_compleater || !isShortcut) QTextEdit::keyPressEvent(e);
+
+ const bool ctrlOrShift = e->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier);
+ if (!m_compleater || (ctrlOrShift && e->text().isEmpty()))
+ return;
+
+ static QString eow("~!@#$%^&*()_+{}|:\"<>?,./;'[]\\-="); // end of word
+ bool hasModifier = (e->modifiers() != Qt::NoModifier) && !ctrlOrShift;
+
+ QString completionPrefix = textUnderCursor();
+
+ if (!isShortcut && (hasModifier || e->text().isEmpty()|| completionPrefix.length() < 3
+ || eow.contains(e->text().right(1)))) {
+ m_compleater->popup()->hide();
+ return;
+ }
+
+ if (completionPrefix != m_compleater->completionPrefix()) {
+ m_compleater->setCompletionPrefix(completionPrefix);
+ m_compleater->popup()->setCurrentIndex(m_compleater->completionModel()->index(0, 0));
+ }
+
+ QRect cr = cursorRect();
+ cr.setWidth(m_compleater->popup()->sizeHintForColumn(0)
+ + m_compleater->popup()->verticalScrollBar()->sizeHint().width());
+ m_compleater->complete(cr);
+
+}
+
+void CompleaterTextEditor::focusInEvent(QFocusEvent *e)
+{
+ if (m_compleater) m_compleater->setWidget(this);
+ QTextEdit::focusInEvent(e);
+}
+
+QString CompleaterTextEditor::textUnderCursor() const
+{
+ QTextCursor tc = textCursor();
+ tc.select(QTextCursor::WordUnderCursor);
+ return tc.selectedText();
+}
+
+
+void CompleaterTextEditor::insertCompletion(const QString &completion)
+{
+ if (m_compleater->widget() != this)
+ return;
+ QTextCursor tc = textCursor();
+ int extra = completion.length() - m_compleater->completionPrefix().length();
+ tc.movePosition(QTextCursor::Left);
+ tc.movePosition(QTextCursor::EndOfWord);
+ tc.insertText(completion.right(extra));
+ setTextCursor(tc);
+}
+
+void TextItemEditor::on_twData_doubleClicked(const QModelIndex &index)
+{
+ if (!index.isValid()) return;
+ LimeReport::DataNode* node = static_cast(index.internalPointer());
+ if (node->type()==LimeReport::DataNode::Field){
+ m_teContent->insertPlainText(QString("$D{%1.%2}").arg(node->parent()->name()).arg(node->name()));
+ }
+ if (node->type()==LimeReport::DataNode::Variable){
+ m_teContent->insertPlainText(QString("$V{%1}").arg(node->name()));
+ }
+}
+
+void TextItemEditor::on_twScriptEngine_doubleClicked(const QModelIndex &index)
+{
+ if (!index.isValid()) return;
+ LimeReport::ScriptEngineNode* node = static_cast(index.internalPointer());
+ if (node->type()==LimeReport::ScriptEngineNode::Function){
+ m_teContent->insertPlainText(node->name()+"()");
+ }
+}
+
+void TextItemEditor::on_splitter_splitterMoved(int , int )
+{
+#ifdef unix
+ writeSetting();
+#endif
+}
+
+void TextItemEditor::on_editorFont_currentFontChanged(const QFont &f)
+{
+ if (m_isReadingSetting) return;
+ QFont tmp = f;
+ tmp.setPointSize(ui->editorFontSize->value());
+ ui->textEdit->setFont(tmp);
+ settings()->beginGroup("TextItemEditor");
+ settings()->setValue("FontName",ui->textEdit->font().family());
+ settings()->setValue("FontSize",ui->editorFontSize->value());
+ settings()->endGroup();
+}
+
+void TextItemEditor::on_editorFontSize_valueChanged(int arg1)
+{
+ if (m_isReadingSetting) return;
+ ui->textEdit->setFont(QFont(ui->textEdit->font().family(),arg1));
+ settings()->beginGroup("TextItemEditor");
+ settings()->setValue("FontName",ui->textEdit->font().family());
+ settings()->setValue("FontSize",ui->editorFontSize->value());
+ settings()->endGroup();
+}
+
+void TextItemEditor::on_toolButton_clicked(bool checked)
+{
+ ui->gbSettings->setVisible(checked);
+}
diff --git a/src/items/lrtextitemeditor.h b/src/items/lrtextitemeditor.h
new file mode 100644
index 0000000..e6ce2f5
--- /dev/null
+++ b/src/items/lrtextitemeditor.h
@@ -0,0 +1,106 @@
+/***************************************************************************
+ * This file is part of the Lime Report project *
+ * Copyright (C) 2015 by Alexander Arin *
+ * arin_a@bk.ru *
+ * *
+ ** GNU General Public License Usage **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+ * *
+ ** GNU Lesser General Public License **
+ * *
+ * This library is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation, either version 3 of the *
+ * License, or (at your option) any later version. *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library. *
+ * If not, see . *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ ****************************************************************************/
+#ifndef LRTEXTITEMEDITOR_H
+#define LRTEXTITEMEDITOR_H
+
+#include
+#include
+#include
+
+#include "lrtextitem.h"
+#include "lrpagedesignintf.h"
+
+namespace Ui {
+class TextItemEditor;
+}
+
+class CompleaterTextEditor :public QTextEdit
+{
+ Q_OBJECT
+public:
+ CompleaterTextEditor(QWidget* parent=0);
+ void setCompleter(QCompleter* value);
+ QCompleter* compleater() const{ return m_compleater;}
+protected:
+ virtual void keyPressEvent(QKeyEvent *e);
+ virtual void focusInEvent(QFocusEvent *e);
+private:
+ QString textUnderCursor() const;
+private slots:
+ void insertCompletion(const QString& completion);
+private:
+ QCompleter* m_compleater;
+};
+
+class TextItemEditor : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit TextItemEditor(LimeReport::TextItem* item, LimeReport::PageDesignIntf* page,
+ QSettings* settings=0, QWidget *parent = 0);
+ ~TextItemEditor();
+ void setSettings(QSettings* value);
+ QSettings* settings();
+protected:
+ void resizeEvent(QResizeEvent *);
+ void moveEvent(QMoveEvent *);
+private slots:
+ void on_pbOk_clicked();
+ void on_pbCancel_clicked();
+ void slotFieldSelected();
+ void on_twData_doubleClicked(const QModelIndex &index);
+ void on_twScriptEngine_doubleClicked(const QModelIndex &index);
+ void on_splitter_splitterMoved(int, int);
+ void on_editorFont_currentFontChanged(const QFont &f);
+
+ void on_editorFontSize_valueChanged(int arg1);
+
+ void on_toolButton_clicked(bool checked);
+
+private:
+ void initUI();
+ void readSetting();
+ void writeSetting();
+ QStringListModel* getDataSources();
+ QStringListModel* getPrefixes();
+ QStringListModel* getColumns(QString datasource);
+private:
+ Ui::TextItemEditor *ui;
+ LimeReport::TextItem* m_textItem;
+ LimeReport::PageDesignIntf* m_page;
+ QMenu* m_datasourcesMenu;
+ CompleaterTextEditor* m_teContent;
+ QCompleter* m_completer;
+ QSettings* m_settings;
+ bool m_ownedSettings;
+ bool m_isReadingSetting;
+};
+
+#endif // LRTEXTITEMEDITOR_H
diff --git a/src/items/lrtextitemeditor.ui b/src/items/lrtextitemeditor.ui
new file mode 100644
index 0000000..0934c90
--- /dev/null
+++ b/src/items/lrtextitemeditor.ui
@@ -0,0 +1,251 @@
+
+
+ TextItemEditor
+
+
+ Qt::ApplicationModal
+
+
+
+ 0
+ 0
+ 539
+ 436
+
+
+
+ Text Item Editor
+
+
+
+ :/items/images/insert-text_3.png:/items/images/insert-text_3.png
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+ Content
+
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
+
+
+
+ 0
+ 0
+
+
+
+ Qt::Horizontal
+
+
+
+
+