summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-20 21:15:04 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-22 09:39:15 +0100
commit64d9d21d495fd5efa2ec624a181f204f8e914878 (patch)
treeb845442376869309651ea47ac62a239b069c149b /xmloff
parent477a7e71d18f4a00f82e412a953d5e96e3d2979d (diff)
wrong seekPage
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/forms/layerexport.cxx24
-rw-r--r--xmloff/source/forms/layerexport.hxx10
-rw-r--r--xmloff/source/forms/layerimport.cxx8
-rw-r--r--xmloff/source/forms/layerimport.hxx5
4 files changed, 34 insertions, 13 deletions
diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx
index 464bb0a08e8c..9336c1e6e7a6 100644
--- a/xmloff/source/forms/layerexport.cxx
+++ b/xmloff/source/forms/layerexport.cxx
@@ -376,6 +376,30 @@ namespace xmloff
}
//---------------------------------------------------------------------
+ sal_Bool OFormLayerXMLExport_Impl::seekPage(const Reference< XDrawPage >& _rxDrawPage)
+ {
+ sal_Bool bKnownPage = implMoveIterators( _rxDrawPage, sal_False );
+ if ( bKnownPage )
+ return sal_True;
+
+ // if the page is not yet known, this does not automatically mean that it has
+ // not been examined. Instead, examineForms returns silently and successfully
+ // if a page is a XFormsPageSupplier2, but does not have a forms collection
+ // (This behaviour of examineForms is a performance optimization, to not force
+ // the page to create a forms container just to see that it's empty.)
+
+ // So, in such a case, seekPage is considered to be successfull, too, though the
+ // page was not yet known
+ Reference< XFormsSupplier2 > xFormsSupp( _rxDrawPage, UNO_QUERY );
+ if ( xFormsSupp.is() && !xFormsSupp->hasForms() )
+ return sal_True;
+
+ // anything else means that the page has not been examined before, or it's no
+ // valid form page. Both cases are Bad (TM).
+ return sal_False;
+ }
+
+ //---------------------------------------------------------------------
::rtl::OUString OFormLayerXMLExport_Impl::getControlId(const Reference< XPropertySet >& _rxControl)
{
if (m_aCurrentPageIds == m_aControlIds.end())
diff --git a/xmloff/source/forms/layerexport.hxx b/xmloff/source/forms/layerexport.hxx
index dbb918a83509..2963667a464a 100644
--- a/xmloff/source/forms/layerexport.hxx
+++ b/xmloff/source/forms/layerexport.hxx
@@ -152,6 +152,16 @@ namespace xmloff
const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& _rEvents
);
+ /** seek to the page given.
+
+ <p>This must be called before you can retrieve any ids for controls on the page.</p>
+
+ @see
+ getControlId
+ */
+ sal_Bool seekPage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
+
/** get the id of the given control.
<p>You must have sought to the page of the control before calling this.</p>
diff --git a/xmloff/source/forms/layerimport.cxx b/xmloff/source/forms/layerimport.cxx
index 7b40189d5145..f1b026256068 100644
--- a/xmloff/source/forms/layerimport.cxx
+++ b/xmloff/source/forms/layerimport.cxx
@@ -543,14 +543,6 @@ SvXMLImportContext* OFormLayerXMLImport_Impl::createContext(const sal_uInt16 _nP
}
//---------------------------------------------------------------------
-void OFormLayerXMLImport_Impl::seekPage(const Reference< XDrawPage >& _rxDrawPage)
-{
- OSL_ENSURE(m_aCurrentPageIds == m_aControlIds.end(), "OFormLayerXMLImport_Impl::seekPage: importing another page currently! This will smash your import!");
- m_aCurrentPageIds = m_aControlIds.find(_rxDrawPage);
- OSL_ENSURE(m_aCurrentPageIds != m_aControlIds.end(), "OFormLayerXMLImport_Impl::seekPage: did not find the given page (perhaps it has not been imported, yet?)!");
-}
-
-//---------------------------------------------------------------------
void OFormLayerXMLImport_Impl::documentDone( )
{
SvXMLImport& rImport = getGlobalContext();
diff --git a/xmloff/source/forms/layerimport.hxx b/xmloff/source/forms/layerimport.hxx
index 34cbbe6d1b6c..22515f443155 100644
--- a/xmloff/source/forms/layerimport.hxx
+++ b/xmloff/source/forms/layerimport.hxx
@@ -173,11 +173,6 @@ namespace xmloff
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
lookupControlId(const ::rtl::OUString& _rControlId);
- /** seek to the given page
- */
- void seekPage(
- const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
-
/** announces the auto-style context to the form importer
*/
void setAutoStyleContext(SvXMLStylesContext* _pNewContext);