diff options
Diffstat (limited to 'include/svx')
-rw-r--r-- | include/svx/ClassificationDialog.hxx | 63 | ||||
-rw-r--r-- | include/svx/ClassificationEditView.hxx | 67 | ||||
-rw-r--r-- | include/svx/ClassificationField.hxx | 67 | ||||
-rw-r--r-- | include/svx/svxids.hrc | 3 |
4 files changed, 199 insertions, 1 deletions
diff --git a/include/svx/ClassificationDialog.hxx b/include/svx/ClassificationDialog.hxx new file mode 100644 index 000000000000..c0612124df99 --- /dev/null +++ b/include/svx/ClassificationDialog.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#ifndef INCLUDED_SVX_CLASSIFICATIONDIALOG_HXX +#define INCLUDED_SVX_CLASSIFICATIONDIALOG_HXX + +#include <sal/config.h> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/edit.hxx> +#include <svx/svxdllapi.h> +#include <svx/ClassificationEditView.hxx> +#include <sfx2/classificationhelper.hxx> +#include <svx/ClassificationField.hxx> + +namespace svx { + +class SVX_DLLPUBLIC ClassificationDialog : public ModalDialog +{ +private: + VclPtr<ClassificationEditView> m_pEditWindow; + VclPtr<PushButton> m_pBoldButton; + VclPtr<ListBox> m_pClassificationListBox; + VclPtr<ListBox> m_pInternationalClassificationListBox; + VclPtr<ListBox> m_pMarkingListBox; + VclPtr<ListBox> m_pIntellectualPropertyPartListBox; + VclPtr<ListBox> m_pIntellectualPropertyPartNumberListBox; + VclPtr<PushButton> m_pIntellectualPropertyPartAddButton; + VclPtr<Edit> m_pIntellectualPropertyPartEdit; + + SfxClassificationHelper maHelper; + SfxClassificationHelper maInternationalHelper; + + DECL_LINK(ButtonClicked, Button*, void); + DECL_LINK(SelectClassificationHdl, ListBox&, void); + DECL_LINK(SelectMarkingHdl, ListBox&, void); + DECL_LINK(SelectIPPartNumbersHdl, ListBox&, void); + DECL_LINK(DoubleClickIPPartHdl, ListBox&, void); + + void insertField(ClassificationType eType, OUString const & rString); + +public: + ClassificationDialog(vcl::Window* pParent); + virtual ~ClassificationDialog() override; + virtual void dispose() override; + + std::vector<ClassificationResult> getResult(); + void setupValues(std::vector<ClassificationResult> const & rInput); +}; + +} // end svx namespace + +#endif // INCLUDED_SVX_CLASSIFICATIONDIALOG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/ClassificationEditView.hxx b/include/svx/ClassificationEditView.hxx new file mode 100644 index 000000000000..2231aa63eb48 --- /dev/null +++ b/include/svx/ClassificationEditView.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#ifndef INCLUDED_SVX_CLASSIFICATIONEDITVIEW_HXX +#define INCLUDED_SVX_CLASSIFICATIONEDITVIEW_HXX + +#include <sal/config.h> +#include <svx/svxdllapi.h> +#include <vcl/dialog.hxx> +#include <editeng/flditem.hxx> +#include <editeng/numitem.hxx> +#include <editeng/editeng.hxx> +#include <editeng/editview.hxx> + +namespace svx { + +class ClassificationEditEngine : public EditEngine +{ +public: + ClassificationEditEngine(SfxItemPool* pItemPool); + + virtual OUString CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor) override; +}; + +class SVX_DLLPUBLIC ClassificationEditView : public Control +{ +public: + ClassificationEditView(vcl::Window* pParent, WinBits nBits); + virtual ~ClassificationEditView() override; + + using Control::SetFont; + using Control::SetText; + + void SetCharAttributes(); + + void InsertField(const SvxFieldItem& rField); + + void InvertSelectionWeight(); + + void SetNumType(SvxNumType eNumType); + + std::unique_ptr<ClassificationEditEngine> pEdEngine; + std::unique_ptr<EditView> pEdView; + +protected: + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual void MouseMove( const MouseEvent& rMEvt ) override; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; + virtual void KeyInput( const KeyEvent& rKEvt ) override; + virtual void Command( const CommandEvent& rCEvt ) override; + virtual void GetFocus() override; + virtual void Resize() override; +}; + +} // end svx namespace + +#endif // INCLUDED_SVX_CLASSIFICATIONEDITVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/ClassificationField.hxx b/include/svx/ClassificationField.hxx new file mode 100644 index 000000000000..53237dae1921 --- /dev/null +++ b/include/svx/ClassificationField.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#ifndef INCLUDED_SVX_CLASSIFICATIONFIELD_HXX +#define INCLUDED_SVX_CLASSIFICATIONFIELD_HXX + +#include <sal/config.h> +#include <svx/svxdllapi.h> +#include <editeng/flditem.hxx> + +namespace svx { + +enum class ClassificationType +{ + CATEGORY, + MARKING, + TEXT, + INTELLECTUAL_PROPERTY_PART +}; + +class SVX_DLLPUBLIC ClassificationField : public SvxFieldData +{ +public: + ClassificationType meType; + OUString msDescription; + + ClassificationField(ClassificationType eType, OUString const & sDescription) + : SvxFieldData() + , meType(eType) + , msDescription(sDescription) + {} + + ClassificationField* Clone() const override + { + return new ClassificationField(meType, msDescription); + } + + bool operator==(const SvxFieldData& rOther) const override + { + if (typeid(rOther) != typeid(*this)) + return false; + + const ClassificationField& rOtherField = static_cast<const ClassificationField&>(rOther); + return (meType == rOtherField.meType && + msDescription == rOtherField.msDescription); + } +}; + +struct SVX_DLLPUBLIC ClassificationResult +{ + ClassificationType meType; + OUString msString; + sal_Int32 mnParagraph; +}; + +} // end svx namespace + +#endif // INCLUDED_SVX_CLASSIFICATIONFIELD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 157eb35431f1..6300b67b6b19 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -974,9 +974,10 @@ #define SID_AUTHOR_COLOR ( SID_SVX_START + 1168 ) #define SID_BMPMASK_COLOR ( SID_SVX_START + 1169 ) #define SID_PARA_SIGNATURE_ADD ( SID_SVX_START + 1170 ) +#define SID_CLASSIFICATION_DIALOG ( SID_SVX_START + 1171 ) // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE ( SID_PARA_SIGNATURE_ADD + 1 ) +#define SID_SVX_FIRSTFREE ( SID_CLASSIFICATION_DIALOG + 1 ) // Overflow check for slot IDs #if SID_SVX_FIRSTFREE > SID_SVX_END |