Kaydet (Commit) fbc44fe6 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

tscp: advanced classification dialog for impress

Change-Id: I76c81e6f84de8160c20f1614d7676f2f2c3fb155
Reviewed-on: https://gerrit.libreoffice.org/43361Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 1bd14849
......@@ -70,6 +70,7 @@ $(eval $(call gb_Library_add_exception_objects,editeng,\
editeng/source/editeng/textconv \
editeng/source/items/borderline \
editeng/source/items/bulitem \
editeng/source/items/CustomPropertyField \
editeng/source/items/charhiddenitem \
editeng/source/items/flditem \
editeng/source/items/frmitems \
......
/* -*- 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/.
*
*/
#include <editeng/CustomPropertyField.hxx>
#include <vcl/metaact.hxx>
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
using namespace css;
namespace editeng
{
CustomPropertyField::CustomPropertyField()
: SvxFieldData()
{}
CustomPropertyField::CustomPropertyField(OUString const & rKey)
: SvxFieldData()
, msKey(rKey)
{}
CustomPropertyField::~CustomPropertyField()
{}
SV_IMPL_PERSIST1(CustomPropertyField);
SvxFieldData* CustomPropertyField::Clone() const
{
return new CustomPropertyField(msKey);
}
bool CustomPropertyField::operator==(const SvxFieldData& rOther) const
{
if (typeid(rOther) != typeid(*this))
return false;
const CustomPropertyField& rOtherField = static_cast<const CustomPropertyField&>(rOther);
return (msKey == rOtherField.msKey);
}
MetaAction* CustomPropertyField::createBeginComment() const
{
return new MetaCommentAction("FIELD_SEQ_BEGIN");
}
OUString CustomPropertyField::GetFormatted(uno::Reference<document::XDocumentProperties> const & xDocumentProperties) const
{
if (!xDocumentProperties.is())
return OUString();
uno::Reference<beans::XPropertyContainer> xPropertyContainer = xDocumentProperties->getUserDefinedProperties();
if (!xPropertyContainer.is())
return OUString();
uno::Reference<beans::XPropertySet> xPropertySet(xPropertyContainer, uno::UNO_QUERY);
if (!xPropertySet.is())
return OUString();
uno::Any aAny = xPropertySet->getPropertyValue(msKey);
if (!aAny.has<OUString>())
return OUString();
return aAny.get<OUString>();
}
} // end editeng namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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_EDITENG_CUSTOMPROPERTYFIELD_HXX
#define INCLUDED_EDITENG_CUSTOMPROPERTYFIELD_HXX
#include <editeng/editengdllapi.h>
#include <editeng/flditem.hxx>
#include <editeng/eeitem.hxx>
#include <com/sun/star/text/textfield/Type.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
namespace editeng
{
class EDITENG_DLLPUBLIC CustomPropertyField : public SvxFieldData
{
private:
OUString msKey;
public:
CustomPropertyField();
explicit CustomPropertyField(OUString const & rKey);
virtual ~CustomPropertyField() override;
SV_DECL_PERSIST1(CustomPropertyField, css::text::textfield::Type::CUSTOM_PROPERTY)
virtual SvxFieldData* Clone() const override;
virtual bool operator==(const SvxFieldData&) const override;
virtual MetaAction* createBeginComment() const override;
OUString GetFormatted(css::uno::Reference<css::document::XDocumentProperties> const & xDocumentProperties) const;
OUString GetKey() const
{
return msKey;
}
};
} // end editeng namespace
#endif // INCLUDED_EDITENG_CUSTOMPROPERTYFIELD_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -42,7 +42,8 @@ constants Type
const long PRESENTATION_HEADER = 11;
const long PRESENTATION_FOOTER = 12;
const long PRESENTATION_DATE_TIME = 13;
const long PAGE_NAME = 14;
const long PAGE_NAME = 14;
const long CUSTOM_PROPERTY = 15;
};
}; }; }; }; };
......
......@@ -2776,5 +2776,9 @@ interface DrawView
[
ExecMethod = FuTemporary ;
]
SID_CLASSIFICATION_DIALOG
[
ExecMethod = FuTemporary ;
]
}
......@@ -19,6 +19,7 @@
#include <editeng/eeitem.hxx>
#include <editeng/flditem.hxx>
#include <editeng/CustomPropertyField.hxx>
#include <o3tl/make_unique.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/styfitem.hxx>
......@@ -175,6 +176,8 @@ IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void)
const SvxAuthorField* pAuthorField = nullptr;
const SvxURLField* pURLField = nullptr;
const editeng::CustomPropertyField* pCustomPropertyField = nullptr;
if( (pDateField = dynamic_cast< const SvxDateField* >(pField)) != nullptr )
{
LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() );
......@@ -250,7 +253,6 @@ IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void)
pInfo->SetRepresentation( aRepresentation );
}
else if( dynamic_cast< const SvxPageTitleField* >(pField) )
{
OUString aRepresentation(" ");
......@@ -345,6 +347,10 @@ IMPL_LINK(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void)
{
pInfo->ClearFieldColor();
}
else if ((pCustomPropertyField = dynamic_cast<const editeng::CustomPropertyField*>(pField)) != nullptr)
{
pInfo->SetRepresentation(pCustomPropertyField->GetFormatted(SfxObjectShell::Current()->getDocProperties()));
}
else
{
OUString aRepresentation;
......
This diff is collapsed.
......@@ -9,4 +9,5 @@
-->
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:ClassificationApply"/>
<toolbar:toolbaritem xlink:href=".uno:ClassificationDialog"/>
</toolbar:toolbar>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment