Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
fa72b6e9
Kaydet (Commit)
fa72b6e9
authored
Şub 24, 2016
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sw classification: put the relevant field to the footer if policy wants so
Change-Id: I61c235660366ec1aba137097600605aae76c39a7
üst
a3a7a708
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
22 deletions
+69
-22
classificationhelper.hxx
include/sfx2/classificationhelper.hxx
+4
-0
classificationhelper.cxx
sfx2/source/view/classificationhelper.cxx
+20
-5
edfcol.cxx
sw/source/core/edit/edfcol.cxx
+45
-17
No files found.
include/sfx2/classificationhelper.hxx
Dosyayı görüntüle @
fa72b6e9
...
...
@@ -43,10 +43,14 @@ public:
OUString
GetDocumentWatermark
();
/// The selected category has some content for the document header.
bool
HasDocumentHeader
();
/// The selected category has some content for the document footer.
bool
HasDocumentFooter
();
void
UpdateInfobar
(
SfxViewFrame
&
rViewFrame
);
/// Brief text located at the top of each document's pages.
static
const
OUString
&
PROP_DOCHEADER
();
/// Brief text located at the bottom of each document's pages.
static
const
OUString
&
PROP_DOCFOOTER
();
};
#endif
...
...
sfx2/source/view/classificationhelper.cxx
Dosyayı görüntüle @
fa72b6e9
...
...
@@ -163,8 +163,8 @@ throw (xml::sax::SAXException, uno::RuntimeException, std::exception)
rCategory
.
m_aLabels
[
"urn:bails:IntellectualProperty:Marking:general-distribution-statement:ext:2"
].
clear
();
rCategory
.
m_aLabels
[
"urn:bails:IntellectualProperty:Marking:general-distribution-statement:ext:3"
].
clear
();
rCategory
.
m_aLabels
[
"urn:bails:IntellectualProperty:Marking:general-distribution-statement:ext:4"
].
clear
();
rCategory
.
m_aLabels
[
"urn:bails:IntellectualProperty:Marking:document-footer"
].
clear
();
rCategory
.
m_aLabels
[
"urn:bails:IntellectualProperty:Marking:document-header"
].
clear
();
rCategory
.
m_aLabels
[
SfxClassificationHelper
::
PROP_DOCHEADER
()
].
clear
();
rCategory
.
m_aLabels
[
SfxClassificationHelper
::
PROP_DOCFOOTER
()
].
clear
();
rCategory
.
m_aLabels
[
"urn:bails:IntellectualProperty:Marking:document-watermark"
].
clear
();
rCategory
.
m_aLabels
[
"urn:bails:IntellectualProperty:Marking:email-first-line-of-text"
].
clear
();
rCategory
.
m_aLabels
[
"urn:bails:IntellectualProperty:Marking:email-last-line-of-text"
].
clear
();
...
...
@@ -235,9 +235,9 @@ void SAL_CALL SfxClassificationParser::endElement(const OUString& rName) throw (
if
(
m_pCategory
)
{
if
(
m_aIdentifier
==
"Document: Header"
)
m_pCategory
->
m_aLabels
[
"urn:bails:IntellectualProperty:Marking:document-header"
]
=
m_aValue
;
m_pCategory
->
m_aLabels
[
SfxClassificationHelper
::
PROP_DOCHEADER
()
]
=
m_aValue
;
else
if
(
m_aIdentifier
==
"Document: Footer"
)
m_pCategory
->
m_aLabels
[
"urn:bails:IntellectualProperty:Marking:document-footer"
]
=
m_aValue
;
m_pCategory
->
m_aLabels
[
SfxClassificationHelper
::
PROP_DOCFOOTER
()
]
=
m_aValue
;
else
if
(
m_aIdentifier
==
"Document: Watermark"
)
m_pCategory
->
m_aLabels
[
"urn:bails:IntellectualProperty:Marking:document-watermark"
]
=
m_aValue
;
}
...
...
@@ -418,7 +418,16 @@ bool SfxClassificationHelper::HasImpactLevel()
bool
SfxClassificationHelper
::
HasDocumentHeader
()
{
std
::
map
<
OUString
,
OUString
>::
iterator
it
=
m_pImpl
->
m_aLabels
.
find
(
"urn:bails:IntellectualProperty:Marking:document-header"
);
std
::
map
<
OUString
,
OUString
>::
iterator
it
=
m_pImpl
->
m_aLabels
.
find
(
SfxClassificationHelper
::
PROP_DOCHEADER
());
if
(
it
==
m_pImpl
->
m_aLabels
.
end
()
||
it
->
second
.
isEmpty
())
return
false
;
return
true
;
}
bool
SfxClassificationHelper
::
HasDocumentFooter
()
{
std
::
map
<
OUString
,
OUString
>::
iterator
it
=
m_pImpl
->
m_aLabels
.
find
(
SfxClassificationHelper
::
PROP_DOCFOOTER
());
if
(
it
==
m_pImpl
->
m_aLabels
.
end
()
||
it
->
second
.
isEmpty
())
return
false
;
...
...
@@ -527,4 +536,10 @@ const OUString& SfxClassificationHelper::PROP_DOCHEADER()
return
sProp
;
}
const
OUString
&
SfxClassificationHelper
::
PROP_DOCFOOTER
()
{
static
OUString
sProp
(
"urn:bails:IntellectualProperty:Marking:document-footer"
);
return
sProp
;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sw/source/core/edit/edfcol.cxx
Dosyayı görüntüle @
fa72b6e9
...
...
@@ -123,7 +123,10 @@ void SwEditShell::SetClassification(const OUString& rName)
// This updates the infobar as well.
aHelper
.
SetBACName
(
rName
);
if
(
aHelper
.
HasDocumentHeader
())
bool
bHeaderIsNeeded
=
aHelper
.
HasDocumentHeader
();
bool
bFooterIsNeeded
=
aHelper
.
HasDocumentFooter
();
if
(
bHeaderIsNeeded
||
bFooterIsNeeded
)
{
uno
::
Reference
<
frame
::
XModel
>
xModel
=
pDocShell
->
GetBaseModel
();
uno
::
Reference
<
style
::
XStyleFamiliesSupplier
>
xStyleFamiliesSupplier
(
xModel
,
uno
::
UNO_QUERY
);
...
...
@@ -134,25 +137,50 @@ void SwEditShell::SetClassification(const OUString& rName)
for
(
const
OUString
&
rPageStyleName
:
aUsedPageStyles
)
{
uno
::
Reference
<
beans
::
XPropertySet
>
xPageStyle
(
xStyleFamily
->
getByName
(
rPageStyleName
),
uno
::
UNO_QUERY
);
OUString
aServiceName
=
"com.sun.star.text.TextField.DocInfo.Custom"
;
// If the header is off, turn it on.
bool
bHeaderIsOn
=
false
;
xPageStyle
->
getPropertyValue
(
UNO_NAME_HEADER_IS_ON
)
>>=
bHeaderIsOn
;
if
(
!
bHeaderIsOn
)
xPageStyle
->
setPropertyValue
(
UNO_NAME_HEADER_IS_ON
,
uno
::
makeAny
(
true
));
if
(
bHeaderIsNeeded
)
{
// If the header is off, turn it on.
bool
bHeaderIsOn
=
false
;
xPageStyle
->
getPropertyValue
(
UNO_NAME_HEADER_IS_ON
)
>>=
bHeaderIsOn
;
if
(
!
bHeaderIsOn
)
xPageStyle
->
setPropertyValue
(
UNO_NAME_HEADER_IS_ON
,
uno
::
makeAny
(
true
));
// If the header already contains a document header field, no need to do anything.
uno
::
Reference
<
text
::
XText
>
xHeaderText
;
xPageStyle
->
getPropertyValue
(
UNO_NAME_HEADER_TEXT
)
>>=
xHeaderText
;
if
(
!
lcl_hasField
(
xHeaderText
,
aServiceName
,
SfxClassificationHelper
::
PROP_DOCHEADER
()))
{
// Append a field to the end of the header text.
uno
::
Reference
<
lang
::
XMultiServiceFactory
>
xMultiServiceFactory
(
xModel
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
beans
::
XPropertySet
>
xField
(
xMultiServiceFactory
->
createInstance
(
aServiceName
),
uno
::
UNO_QUERY
);
xField
->
setPropertyValue
(
UNO_NAME_NAME
,
uno
::
makeAny
(
SfxClassificationHelper
::
PROP_DOCHEADER
()));
uno
::
Reference
<
text
::
XTextContent
>
xTextContent
(
xField
,
uno
::
UNO_QUERY
);
xHeaderText
->
insertTextContent
(
xHeaderText
->
getEnd
(),
xTextContent
,
/*bAbsorb=*/
false
);
}
}
// If the header already contains a document header field, no need to do anything.
uno
::
Reference
<
text
::
XText
>
xHeaderText
;
xPageStyle
->
getPropertyValue
(
UNO_NAME_HEADER_TEXT
)
>>=
xHeaderText
;
OUString
aServiceName
=
"com.sun.star.text.TextField.DocInfo.Custom"
;
if
(
!
lcl_hasField
(
xHeaderText
,
aServiceName
,
SfxClassificationHelper
::
PROP_DOCHEADER
()))
if
(
bFooterIsNeeded
)
{
// Append a field to the end of the header text.
uno
::
Reference
<
lang
::
XMultiServiceFactory
>
xMultiServiceFactory
(
xModel
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
beans
::
XPropertySet
>
xField
(
xMultiServiceFactory
->
createInstance
(
aServiceName
),
uno
::
UNO_QUERY
);
xField
->
setPropertyValue
(
UNO_NAME_NAME
,
uno
::
makeAny
(
SfxClassificationHelper
::
PROP_DOCHEADER
()));
uno
::
Reference
<
text
::
XTextContent
>
xTextContent
(
xField
,
uno
::
UNO_QUERY
);
xHeaderText
->
insertTextContent
(
xHeaderText
->
getEnd
(),
xTextContent
,
/*bAbsorb=*/
false
);
// If the footer is off, turn it on.
bool
bFooterIsOn
=
false
;
xPageStyle
->
getPropertyValue
(
UNO_NAME_FOOTER_IS_ON
)
>>=
bFooterIsOn
;
if
(
!
bFooterIsOn
)
xPageStyle
->
setPropertyValue
(
UNO_NAME_FOOTER_IS_ON
,
uno
::
makeAny
(
true
));
// If the footer already contains a document header field, no need to do anything.
uno
::
Reference
<
text
::
XText
>
xFooterText
;
xPageStyle
->
getPropertyValue
(
UNO_NAME_FOOTER_TEXT
)
>>=
xFooterText
;
if
(
!
lcl_hasField
(
xFooterText
,
aServiceName
,
SfxClassificationHelper
::
PROP_DOCFOOTER
()))
{
// Append a field to the end of the footer text.
uno
::
Reference
<
lang
::
XMultiServiceFactory
>
xMultiServiceFactory
(
xModel
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
beans
::
XPropertySet
>
xField
(
xMultiServiceFactory
->
createInstance
(
aServiceName
),
uno
::
UNO_QUERY
);
xField
->
setPropertyValue
(
UNO_NAME_NAME
,
uno
::
makeAny
(
SfxClassificationHelper
::
PROP_DOCFOOTER
()));
uno
::
Reference
<
text
::
XTextContent
>
xTextContent
(
xField
,
uno
::
UNO_QUERY
);
xFooterText
->
insertTextContent
(
xFooterText
->
getEnd
(),
xTextContent
,
/*bAbsorb=*/
false
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment