21#include <core_resource.hxx>
38#include <com/sun/star/beans/PropertyAttribute.hpp>
39#include <com/sun/star/container/XNameContainer.hpp>
40#include <com/sun/star/frame/FrameSearchFlag.hpp>
41#include <com/sun/star/lang/XSingleServiceFactory.hpp>
42#include <com/sun/star/sdb/CommandType.hpp>
43#include <com/sun/star/sdb/SQLContext.hpp>
44#include <com/sun/star/sdb/XQueriesSupplier.hpp>
45#include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
46#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp>
47#include <com/sun/star/sdbcx/XAppend.hpp>
48#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
49#include <com/sun/star/sdbcx/XDrop.hpp>
50#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
51#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
52#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
53#include <com/sun/star/util/XCloseable.hpp>
54#include <com/sun/star/util/VetoException.hpp>
55#include <com/sun/star/ui/XUIElement.hpp>
66#include <osl/diagnose.h>
71#include <osl/mutex.hxx>
76extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
78 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& )
80 return cppu::acquire(new ::dbaui::OQueryController(context));
93 class OViewController :
public OQueryController
97 return "org.openoffice.comp.dbu.OViewDesign";
101 return {
"com.sun.star.sdb.ViewDesign" };
105 explicit OViewController(
const Reference< XComponentContext >& _rM) : OQueryController(_rM){}
111extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
113 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& )
115 return cppu::acquire(new ::dbaui::OViewController(context));
124 OUString lcl_getObjectResourceString(
TranslateId pResId, sal_Int32 _nCommandType)
126 OUString sMessageText =
DBA_RES(pResId);
127 OUString sObjectType =
DBA_RES(RSC_QUERY_OBJECT_TYPE[_nCommandType]);
128 sMessageText = sMessageText.replaceFirst(
"$object$", sObjectType );
147 void ensureToolbars( OQueryController& _rController,
bool _bDesign )
150 if ( !xLayoutManager.is() )
153 xLayoutManager->lock();
154 static constexpr OUStringLiteral s_sDesignToolbar =
u"private:resource/toolbar/designobjectbar";
155 static constexpr OUStringLiteral s_sSqlToolbar =
u"private:resource/toolbar/sqlobjectbar";
158 xLayoutManager->destroyElement( s_sSqlToolbar );
159 xLayoutManager->createElement( s_sDesignToolbar );
163 xLayoutManager->destroyElement( s_sDesignToolbar );
164 xLayoutManager->createElement( s_sSqlToolbar );
166 xLayoutManager->unlock();
167 xLayoutManager->doLayout();
175 void grabFocusFromLimitBox( OQueryController& _rController )
178 Reference< XUIElement > xUIElement = xLayoutManager->getElement(
"private:resource/toolbar/designobjectbar");
181 Reference< XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY);
183 if( pWindow && pWindow->HasChildPathFocus() )
185 pWindow->GrabFocusToDocument();
193 return "org.openoffice.comp.dbu.OQueryDesign";
198 return {
"com.sun.star.sdb.QueryDesign" };
204 ,m_pParseContext( new
svxform::OSystemParseContext )
205 ,m_aSqlParser( _rM, m_pParseContext.
get() )
207 ,m_nVisibleRows(0x400)
210 ,m_bGraphicalDesign(false)
212 ,m_bEscapeProcessing(true)
224 if ( !getBroadcastHelper().bDisposed && !getBroadcastHelper().bInDispose )
226 OSL_FAIL(
"Please check who doesn't dispose this component!");
284 const sal_Int32
nLength = aProps.getLength();
286 auto pProps = aProps.getArray();
288 "CurrentQueryDesign",
291 PropertyAttribute::READONLY
296 pProps + aProps.getLength(),
300 return new ::cppu::OPropertyArrayHelper(aProps);
315 OQueryController_PBase::disposing();
326 OQueryController_PBase::disposing();
355 case SID_RELATION_ADD_RELATION:
364 case SID_PRINTDOCDIRECT:
379 case SID_BROWSER_CLEAR_QUERY:
382 case SID_QUERY_VIEW_FUNCTIONS:
383 case SID_QUERY_VIEW_TABLES:
384 case SID_QUERY_VIEW_ALIASES:
388 case SID_QUERY_DISTINCT_VALUES:
392 case SID_QUERY_LIMIT:
397 case SID_QUERY_PROP_DLG:
403 case SID_DB_QUERY_PREVIEW:
407#if OSL_DEBUG_LEVEL > 0
439 grabFocusFromLimitBox(*
this);
442 case SID_RELATION_ADD_RELATION:
449 case SID_PRINTDOCDIRECT:
462 grabFocusFromLimitBox(*
this);
497 aError = SQLException(
509 OUString sNewStatement;
520 aError = SQLException(
530 catch(
const SQLException&)
532 aError = ::cppu::getCaughtException();
545 InvalidateFeature(SID_RELATION_ADD_RELATION);
549 case SID_BROWSER_CLEAR_QUERY:
560 case SID_QUERY_VIEW_FUNCTIONS:
561 case SID_QUERY_VIEW_TABLES:
562 case SID_QUERY_VIEW_ALIASES:
566 case SID_QUERY_DISTINCT_VALUES:
570 case SID_QUERY_LIMIT:
571 if ( aArgs.hasElements() && aArgs[0].Name ==
"DBLimit.Value" )
577 case SID_QUERY_PROP_DLG:
578 grabFocusFromLimitBox(*
this);
582 grabFocusFromLimitBox(*
this);
586 case SID_DB_QUERY_PREVIEW:
590 if ( xCloseFrame.is() )
594 xCloseFrame->close(
true );
598 OSL_FAIL(
"OQueryController::Execute(SID_DB_QUERY_PREVIEW): *nobody* is expected to veto closing the preview frame!" );
612 InvalidateFeature(_nId);
617 SQLContext aErrorContext;
618 aErrorContext.Message = lcl_getObjectResourceString( STR_ERROR_PARSING_STATEMENT,
m_nCommandType );
619 aErrorContext.Context = *
this;
620 aErrorContext.Details = lcl_getObjectResourceString( STR_INFO_OPENING_IN_SQL_VIEW,
m_nCommandType );
621 aErrorContext.NextException = _rErrorDetails;
627 OSL_PRECOND(
getContainer(),
"OQueryController::impl_setViewMode: illegal call!" );
629 bool wasModified = isModified();
641 *_pErrorInfo = aError;
650 setModified( wasModified );
655 OJoinController::impl_initialize();
665 OUString sIndependentSQLCommand;
666 if ( rArguments.
get_ensureType(
"IndependentSQLCommand", sIndependentSQLCommand ) )
668 OSL_FAIL(
"OQueryController::impl_initialize: IndependentSQLCommand is regognized for compatibility only!" );
669 sCommand = sIndependentSQLCommand;
673 OUString sCurrentQuery;
676 OSL_FAIL(
"OQueryController::impl_initialize: CurrentQuery is regognized for compatibility only!" );
677 sCommand = sCurrentQuery;
681 bool bCreateView(
false );
682 if ( rArguments.
get_ensureType(
"CreateView", bCreateView ) && bCreateView )
684 OSL_FAIL(
"OQueryController::impl_initialize: CurrentQuery is regognized for compatibility only!" );
703 case CommandType::COMMAND:
708 OSL_FAIL(
"OQueryController::impl_initialize: logic error in code!" );
713 bool bGraphicalDesign(
true );
716 OSL_FAIL(
"OQueryController::impl_initialize: QueryDesignView is regognized for compatibility only!" );
723 bool bEscapeProcessing(
true );
734 bool bForceInitialDesign =
false;
736 aCurrentQueryDesignProps = rArguments.
getOrDefault(
"CurrentQueryDesign", aCurrentQueryDesignProps );
738 if ( aCurrentQueryDesignProps.hasElements() )
749 if ( aCurrentQueryDesign.
has(
"Statement" ) )
753 aCurrentQueryDesign.
remove(
"Statement" );
759 bForceInitialDesign =
true;
762 if ( !ensureConnected() )
767 connectionLostMessage();
768 throw SQLException();
777 if ( xViewsSup.is() )
778 xViews = xViewsSup->getViews();
785 OUString aTitle(
DBA_RES(STR_QUERYDESIGN_NO_VIEW_SUPPORT));
786 OUString aMessage(
DBA_RES(STR_QUERYDESIGN_NO_VIEW_ASK));
791 throw VetoException();
801 throw IllegalArgumentException(
802 DBA_RES(STR_NO_ALTER_VIEW_SUPPORT),
810 OSL_ENSURE(
getDataSource().is(),
"OQueryController::impl_initialize: need a datasource!");
820 if ( bForceInitialDesign )
852 catch(
const SQLException& e)
878 ::osl::MutexGuard aGuard(
getMutex() );
880 return o3tl::getToken(aDefaultName, 0,
' ') + OUString::number(getCurrentStartNumber());
892 OSL_ENSURE(
xFactory.is(),
"Connection doesn't support a querycomposer");
905 OSL_ENSURE(
m_xComposer.is(),
"No querycomposer available!");
917 return OJoinController::Construct(pParent);
930 implDescribeSupportedFeature(
".uno:DBViewFunctions", SID_QUERY_VIEW_FUNCTIONS, CommandGroup::VIEW );
931 implDescribeSupportedFeature(
".uno:DBViewTableNames", SID_QUERY_VIEW_TABLES, CommandGroup::VIEW );
932 implDescribeSupportedFeature(
".uno:DBViewAliases", SID_QUERY_VIEW_ALIASES, CommandGroup::VIEW );
933 implDescribeSupportedFeature(
".uno:DBDistinctValues", SID_QUERY_DISTINCT_VALUES, CommandGroup::FORMAT );
934 implDescribeSupportedFeature(
".uno:DBChangeDesignMode",
ID_BROWSER_SQL, CommandGroup::VIEW );
935 implDescribeSupportedFeature(
".uno:DBClearQuery", SID_BROWSER_CLEAR_QUERY, CommandGroup::EDIT );
937 implDescribeSupportedFeature(
".uno:DBAddRelation", SID_RELATION_ADD_RELATION, CommandGroup::EDIT );
938 implDescribeSupportedFeature(
".uno:DBQueryPreview", SID_DB_QUERY_PREVIEW, CommandGroup::VIEW );
939 implDescribeSupportedFeature(
".uno:DBLimit", SID_QUERY_LIMIT, CommandGroup::FORMAT );
940 implDescribeSupportedFeature(
".uno:DBQueryPropertiesDialog", SID_QUERY_PROP_DLG, CommandGroup::FORMAT );
942#if OSL_DEBUG_LEVEL > 0
951 InvalidateFeature(SID_BROWSER_CLEAR_QUERY);
962 if (
Source.Source == m_aCurrentFrame.getFrame() )
965 ::comphelper::disposeComponent( xPreviewFrame );
1008 if ( !fieldDesc->IsEmpty() )
1011 fieldDesc->Save( aFieldData, i_includingCriteria );
1013 const OUString sFieldSettingName =
"Field" + OUString::number(
i );
1041 InvalidateFeature( SID_QUERY_DISTINCT_VALUES );
1042 InvalidateFeature( SID_QUERY_LIMIT,
nullptr,
true );
1052 return pField->GetColWidth();
1063 if ( xViewsSupp.is() )
1064 xElements = xViewsSupp->getViews();
1069 if ( xQueriesSupp.is() )
1070 xElements = xQueriesSupp->getQueries();
1074 if ( xQueryDefsSupp.is() )
1075 xElements = xQueryDefsSupp->getQueryDefinitions();
1079 OSL_ENSURE( xElements.is(),
"OQueryController::getObjectContainer: unable to obtain the container!" );
1089 OUString sDataSourceName = getDataSourceName();
1090 if ( sDataSourceName.isEmpty() || sTranslatedStmt.isEmpty() )
1096 InvalidateFeature(SID_DB_QUERY_PREVIEW);
1098 URL aWantToDispatch;
1099 aWantToDispatch.Complete =
".component:DB/DataSourceBrowser";
1102 sal_Int32 nSearchFlags = FrameSearchFlag::CHILDREN;
1108 xProv.set( getFrame(), UNO_QUERY );
1110 xDisp = xProv->queryDispatch(aWantToDispatch,
sFrameName, nSearchFlags);
1114 xDisp = xProv->queryDispatch(aWantToDispatch,
sFrameName, FrameSearchFlag::SELF);
1118 auto aProps(::comphelper::InitPropertySequence(
1131 xDisp->dispatch(aWantToDispatch, aProps);
1135 if (xComponent.is())
1138 "OQueryController::executeQuery: oops ... which window do I have here?");
1140 xComponent->addEventListener(xEvtL);
1145 OSL_FAIL(
"Couldn't create a beamer window!");
1150 OSL_FAIL(
"Couldn't create a beamer window!");
1156 OSL_ENSURE( !
editingCommand(),
"OQueryController::askForNewName: not to be called when designing an independent statement!" );
1160 OSL_PRECOND( _xElements.is(),
"OQueryController::askForNewName: invalid container!" );
1161 if ( !_xElements.is() )
1165 bool bNew = _bSaveAs || !_xElements->hasByName(
m_sName );
1168 OUString aDefaultName;
1174 aDefaultName = ::dbtools::createUniqueName(_xElements,
sName.getToken(0,
' '));
1203 OSL_ENSURE(isEditable(),
"Slot ID_BROWSER_SAVEDOC should not be enabled!");
1206 OUString aMessage(
DBA_RES(STR_DATASOURCE_DELETED));
1213 if ( !xElements.is() )
1222 setModified(
false );
1228 if ( sTranslatedStmt.isEmpty() )
1233 OUString sOriginalName(
m_sName );
1238 bool bSuccess =
false;
1243 || ( !xElements->hasByName(
m_sName ) );
1249 if ( xElements->hasByName(
m_sName ) )
1252 if ( xNameCont.is() )
1253 xNameCont->dropByName(
m_sName );
1258 xCont->removeByName(
m_sName );
1266 xQuery = xFact->createDataDescriptor();
1273 if ( xSingleFac.is() )
1274 xQuery.set(xSingleFac->createInstance(), css::uno::UNO_QUERY);
1279 xElements->getByName(
m_sName ) >>= xQuery;
1287 OSL_ENSURE( xQuery ==
m_xAlterView,
"OQueryController::doSaveAsDoc: already have another alterable view ...!?" );
1315 xAppend->appendByDescriptor( xQuery );
1321 xCont->insertByName(
m_sName,
Any( xQuery ) );
1327 if ( xElements->hasByName(
m_sName ) )
1328 xViewProps.set( xElements->getByName(
m_sName ), UNO_QUERY );
1330 if ( !xViewProps.is() )
1331 m_sName = ::dbtools::composeTableName( getMetaData(), xQuery, ::dbtools::EComposeRule::InDataManipulation,
false );
1333 OSL_ENSURE( xElements->hasByName(
m_sName ),
"OQueryController::doSaveAsDoc: newly created view does not exist!" );
1335 if ( xElements->hasByName(
m_sName ) )
1342 if ( xEventListener.is() )
1344 TitleChangedEvent
aEvent;
1345 xEventListener->titleChanged(
aEvent);
1347 releaseNumberForComponent();
1350 setModified(
false );
1354 catch(
const SQLException&)
1386 CommentStrip( OUString sComment,
bool bLastOnLine )
1396static std::vector< CommentStrip >
getComment(
const OUString& rQuery )
1398 std::vector< CommentStrip > aRet;
1401 if (rQuery.indexOf(
"--" ) < 0 && rQuery.indexOf(
"//" ) < 0 &&
1402 rQuery.indexOf(
"/*" ) < 0)
1406 const sal_Int32 nQueryLen = rQuery.getLength();
1407 bool bIsText1 =
false;
1408 bool bIsText2 =
false;
1409 bool bComment2 =
false;
1410 bool bComment =
false;
1411 OUStringBuffer
aBuf;
1412 for (sal_Int32
i=0;
i < nQueryLen; ++
i)
1416 aBuf.append( &pCopy[
i], 1);
1417 if ((
i+1) < nQueryLen)
1419 if (pCopy[
i]==
'*' && pCopy[
i+1]==
'/')
1422 aBuf.append( &pCopy[++
i], 1);
1423 aRet.emplace_back(
aBuf.makeStringAndClear(),
false);
1429 aRet.emplace_back(
aBuf.makeStringAndClear(),
false);
1433 if (pCopy[
i] ==
'\n' ||
i == nQueryLen-1)
1437 if (
i == nQueryLen-1 && pCopy[
i] !=
'\n')
1438 aBuf.append( &pCopy[
i], 1);
1439 aRet.emplace_back(
aBuf.makeStringAndClear(),
true);
1442 else if (!aRet.empty())
1443 aRet.back().mbLastOnLine =
true;
1447 if (pCopy[
i] ==
'\"' && !bIsText2)
1448 bIsText1 = !bIsText1;
1449 else if (pCopy[
i] ==
'\'' && !bIsText1)
1450 bIsText2 = !bIsText2;
1451 if (!bIsText1 && !bIsText2 && (
i+1) < nQueryLen)
1453 if ((pCopy[
i]==
'-' && pCopy[
i+1]==
'-') || (pCopy[
i]==
'/' && pCopy[
i+1]==
'/'))
1455 else if (pCopy[
i]==
'/' && pCopy[
i+1]==
'*')
1459 if (bComment || bComment2)
1460 aBuf.append( &pCopy[
i], 1);
1473static OUString
concatComment(
const OUString& rQuery,
const std::vector< CommentStrip >& rComments )
1476 if (rComments.empty())
1480 const sal_Int32 nLen = rQuery.getLength();
1481 const size_t nComments = rComments.size();
1484 sal_Int32 nBufSize = nLen + nComments;
1485 for (
auto const& comment : rComments)
1486 nBufSize += comment.maComment.getLength();
1487 OUStringBuffer
aBuf( nBufSize );
1488 sal_Int32 nIndBeg = 0;
1489 sal_Int32 nIndLF = rQuery.indexOf(
'\n');
1491 while (nIndLF >= 0 &&
i < nComments)
1493 aBuf.append( pBeg + nIndBeg, nIndLF - nIndBeg);
1498 aBuf.append( pBeg + nIndLF, 1);
1499 nIndBeg = nIndLF + 1;
1500 nIndLF = (nIndBeg < nLen ? rQuery.indexOf(
'\n', nIndBeg) : -1);
1504 aBuf.append( pBeg + nIndBeg, nLen - nIndBeg);
1506 bool bNewLine =
false;
1507 for ( ;
i < nComments; ++
i)
1520 return aBuf.makeStringAndClear();
1527 OUString sTranslatedStmt;
1543 sTranslatedStmt =
m_xComposer->getComposedQuery();
1544 sTranslatedStmt =
concatComment( sTranslatedStmt, aComments);
1546 catch(
const SQLException& e)
1551 sTranslatedStmt.clear();
1561 return sTranslatedStmt;
1567 ::osl::MutexGuard aGuard(
getMutex() );
1569 if ( !isConnected() || !isModified() )
1578 OUString sMessageText( lcl_getObjectResourceString( STR_QUERY_SAVEMODIFIED,
m_nCommandType ) );
1581 VclMessageType::Question, VclButtonsType::YesNo,
1584 xQueryBox->set_default_response(
RET_YES);
1586 nRet = xQueryBox->run();
1599 bool bValid =
false;
1608 if ( xQueries.is() )
1611 if( xQueries->hasByName(
m_sName ) && ( xQueries->getByName(
m_sName ) >>= xProp ) && xProp.is() )
1613 OUString sNewStatement;
1619 bool bNewEscapeProcessing(
true );
1634 OSL_FAIL(
"OQueryController::impl_reset: could not retrieve the layout information from the query!" );
1649 if ( aLayoutInformation.hasElements() )
1665 bool bError(
false );
1674 std::unique_ptr< ::connectivity::OSQLParseNode > pNode(
1693 if ( !i_bForceCurrentControllerSettings && !
editingView() )
1695 OUString aTitle(
DBA_RES(STR_SVT_SQL_SYNTAX_ERROR));
1734 if ( _bFireStatementChange )
1735 fire( &
nHandle, &aNewValue, &aOldValue, 1,
false );
1748 fire( &
nHandle, &aNewValue, &aOldValue, 1,
false );
1763 OSL_ENSURE( getSdbMetaData().isConnected(),
"OQueryController::allowQueries: illegal call!" );
1764 if ( !getSdbMetaData().supportsSubqueriesInFrom() )
1770 return !bCreatingView;
1775 ::osl::MutexGuard aGuard(
getMutex() );
constexpr OUStringLiteral sFrameName
#define ID_BROWSER_EDITDOC
#define ID_BROWSER_ADDTABLE
#define ID_BROWSER_SAVEDOC
#define ID_EDIT_QUERY_DESIGN
#define ID_BROWSER_ESCAPEPROCESSING
#define ID_BROWSER_SAVEASDOC
#define ID_EDIT_QUERY_SQL
#define ID_BROWSER_QUERY_EXECUTE
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
bool has(const OUString &_rValueName) const
bool get_ensureType(const OUString &_rValueName, VALUE_TYPE &_out_rValue) const
bool remove(const OUString &_rValueName)
bool put(const OUString &_rValueName, const VALUE_TYPE &_rValue)
css::uno::Sequence< css::beans::PropertyValue > getPropertyValues() const
VALUE_TYPE getOrDefault(const OUString &_rValueName, const VALUE_TYPE &_rDefault) const
::cppu::IPropertyArrayHelper * getArrayHelper()
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
void registerProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void *_pPointerToMember, const css::uno::Type &_rMemberType)
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
std::unique_ptr< OSQLParseNode > parseTree(OUString &rErrorMessage, const OUString &rStatement, bool bInternational=false)
class implementing the IObjectNameCheck interface, and checking a given name for being valid as eithe...
static css::uno::Reference< css::frame::XLayoutManager > getLayoutManager(const css::uno::Reference< css::frame::XFrame > &_xFrame)
get the layout manager
void loadTableWindows(const ::comphelper::NamedValueCollection &i_rViewSettings)
loads the information for the windows.
virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue > &aArgs) override
void saveTableWindows(::comphelper::NamedValueCollection &o_rViewSettings) const
saves the TableWindows structure in a sequence of property values
virtual void reconnect(bool _bUI) override
virtual FeatureState GetState(sal_uInt16 nId) const override
virtual void impl_onModifyChanged() override
virtual void describeSupportedFeatures() override
virtual void SAL_CALL disposing() override
TTableConnectionData m_vTableConnectionData
TTableWindowData m_vTableData
OJoinTableView * getTableView() const
void setStatement(const OUString &_rsStatement)
void showPreview(const css::uno::Reference< css::frame::XFrame > &_xFrame)
void setSlotEnabled(sal_Int32 _nSlotId, bool _bEnable)
bool isSlotEnabled(sal_Int32 _nSlotId)
OQueryDesignView * getDesignView()
bool isCopyAllowed() const
bool isPasteAllowed() const
bool isCutAllowed() const
void initialize() override
void setNoneVisibleRow(sal_Int32 _nRows)
const css::uno::Reference< css::frame::XFrame2 > & getPreviewFrame() const
bool switchView(::dbtools::SQLExceptionInfo *_pErrorInfo)
css::uno::Reference< css::container::XNameAccess > getObjectContainer() const
returns the container of queries, views, or command definitions, depending on what object type we des...
virtual OUString getPrivateTitle() const override
OUString m_sUpdateCatalogName
virtual FeatureState GetState(sal_uInt16 nId) const override
virtual bool allowQueries() const override
determines whether or not it's allowed for queries to participate in the game
bool editingQuery() const
virtual void SAL_CALL restoreViewData(const css::uno::Any &Data) override
OUString translateStatement(bool _bFireStatementChange=true)
virtual bool allowViews() const override
determines whether or not it's allowed for database views to participate in the game
virtual void onLoadedMenu(const css::uno::Reference< css::frame::XLayoutManager > &_xLayoutManager) override
void impl_setViewMode(::dbtools::SQLExceptionInfo *_pErrorInfo)
switches to the graphical or SQL view mode, as determined by m_bGraphicalDesign
bool isGraphicalDesign() const
::connectivity::OSQLParser m_aSqlParser
virtual short saveModified() override
virtual void impl_initialize() override
bool editingCommand() const
css::uno::Sequence< css::beans::PropertyValue > m_aFieldInformation
virtual bool Construct(vcl::Window *pParent) override
virtual OUString SAL_CALL getImplementationName() override
std::unique_ptr<::svxform::OSystemParseContext > m_pParseContext
void setEscapeProcessing_fireEvent(const bool _bEscapeProcessing)
sets the m_bEscapeProcessing member, and notifies our respective property change listeners
const OUString & getStatement() const
bool askForNewName(const css::uno::Reference< css::container::XNameAccess > &_xElements, bool _bSaveAs)
OQueryContainerWindow * getContainer() const
virtual ~OQueryController() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
OTableFields m_vTableFieldDesc
void saveViewSettings(::comphelper::NamedValueCollection &o_rViewSettings, const bool i_includingCriteria) const
void impl_reset(const bool i_bIgnoreQuerySettings=false)
std::unique_ptr<::connectivity::OSQLParseTreeIterator > m_pSqlIterator
virtual OJoinDesignView * getJoinView() override
provides access to the OJoinDesignView belonging to the controller, which might or might not be the d...
void loadViewSettings(const ::comphelper::NamedValueCollection &o_rViewSettings)
css::uno::Reference< css::sdb::XSQLQueryComposer > m_xComposer
virtual void impl_onModifyChanged() override
bool doSaveAsDoc(bool _bSaveAs)
virtual void describeSupportedFeatures() override
OUString m_sUpdateSchemaName
virtual css::uno::Any SAL_CALL getViewData() override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
sal_Int32 getColWidth(sal_uInt16 _nColPos) const
virtual void reset() override
OTableFields m_vUnUsedFieldsDesc
void impl_showAutoSQLViewError(const css::uno::Any &_rErrorDetails)
tells the user that we needed to switch to SQL view automatically
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
virtual void reconnect(bool _bUI) override
virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue > &aArgs) override
OQueryController(const css::uno::Reference< css::uno::XComponentContext > &_rM)
void execute_QueryPropDlg()
css::uno::Reference< css::sdbcx::XAlterView > m_xAlterView
if we're editing an existing view, this is non-NULL
void setStatement_fireEvent(const OUString &_rNewStatement, bool _bFireStatementChange=true)
sets m_sStatement, and notifies our respective property change listeners
virtual void SAL_CALL disposing() override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
const OUString & getName() const
OUString getSchema() const
OUString getCatalog() const
virtual void SAL_CALL disposing() override
SfxUndoManager & GetUndoManager() const
need for undo's and redo's
void ClearUndoManager()
complete clears the Undo/Redo stacks
Dialog to set such properties of a query as distinct values and limit It can be opened from Edit menu...
sal_Int64 getLimit() const
#define DBG_UNHANDLED_EXCEPTION(...)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Reference< XSingleServiceFactory > xFactory
#define LINK(Instance, Class, Member)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
std::map< OUString, OSQLTable, comphelper::UStringMixLess > OSQLTables
css::uno::Reference< css::uno::XInterface > getDataSource(const css::uno::Reference< css::uno::XInterface > &_rxDependentObject)
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
static OUString concatComment(const OUString &rQuery, const std::vector< CommentStrip > &rComments)
Concat/insert comments that were previously obtained with getComment().
std::vector< OTableFieldDescRef > OTableFields
bool appendToFilter(const css::uno::Reference< css::sdbc::XConnection > &xConnection, const OUString &rName, const css::uno::Reference< css::uno::XComponentContext > &rxContext, weld::Window *pParent)
append a name to tablefilter of a datasource
static std::vector< CommentStrip > getComment(const OUString &rQuery)
Obtain all comments in a query.
::osl::Mutex & getMutex()
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * org_openoffice_comp_dbu_OViewDesign_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * org_openoffice_comp_dbu_OQueryDesign_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(OStatement, OStatementBase, OStatement_IFACE)
IMPLEMENT_FORWARD_XINTERFACE2(OStatement, OStatementBase, OStatement_IFACE)
OUString VCL_DLLPUBLIC GetStandardText(StandardButtonType eButton)
#define PROPERTY_ID_ESCAPE_PROCESSING
#define PROPERTY_ID_ACTIVECOMMAND
#define PROPERTY_ID_CURRENT_QUERY_DESIGN
constexpr OUStringLiteral PROPERTY_COMMAND(u"Command")
constexpr OUStringLiteral PROPERTY_UPDATE_TABLENAME(u"UpdateTableName")
constexpr OUStringLiteral FRAME_NAME_QUERY_PREVIEW
constexpr OUStringLiteral PROPERTY_QUERYDESIGNVIEW(u"QueryDesignView")
constexpr OUStringLiteral PROPERTY_UPDATE_SCHEMANAME(u"UpdateSchemaName")
constexpr OUStringLiteral PROPERTY_SCHEMANAME(u"SchemaName")
constexpr OUStringLiteral PROPERTY_ACTIVE_CONNECTION(u"ActiveConnection")
constexpr OUStringLiteral PROPERTY_ESCAPE_PROCESSING(u"EscapeProcessing")
constexpr OUStringLiteral PROPERTY_CATALOGNAME(u"CatalogName")
constexpr OUStringLiteral PROPERTY_ENABLE_BROWSER(u"EnableBrowser")
constexpr OUStringLiteral PROPERTY_NAME(u"Name")
constexpr OUStringLiteral PROPERTY_UPDATE_CATALOGNAME(u"UpdateCatalogName")
constexpr OUStringLiteral PROPERTY_LAYOUTINFORMATION(u"LayoutInformation")
constexpr OUStringLiteral PROPERTY_DATASOURCENAME(u"DataSourceName")
constexpr OUStringLiteral PROPERTY_ACTIVECOMMAND(u"ActiveCommand")
constexpr OUStringLiteral PROPERTY_GRAPHICAL_DESIGN(u"GraphicalDesign")
constexpr OUStringLiteral PROPERTY_COMMAND_TYPE(u"CommandType")
describes the state of a feature
std::optional< bool > bChecked